Results 1 to 10 of 10
  1. #1
    Loc is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2013
    Posts
    27

    Want to check the status oa a field in a related table

    Can someone please help me with this?

    Two tables Work Orders & Service Orders, I can have many Service Orders to one Work Order. When a service order is entered the user has the option to close out the work order (Checkbox). If someone closed the Work Order and needed to add a forgotten or late submitted service order I want the user to prompted the work order is closed and for it not to run my query to close the work order. I have not done this in VB and looked a some code and it's just not clicking. Can someone help me.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It is not clear to me what you want. Someone closed the Work Order and wants to add another Service Order. You do *NOT* want them to be able to add the Service Order, right?

  3. #3
    Loc is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2013
    Posts
    27
    There has been times when a service orders are not entered in order or more then one person works on a work order. So if the work order is closed because the last work order is entered first or the technician that finishes the work entered his information before the technician who started the work. Then clicks the box that says work order complete it then changes my dates. I want to have an on up date event on my service entry form were if someone clicks work order complete it will go to my work order table and see if this field is checked. If it's checked it messages the user and tells them this work order has already been closed and I don't want my query to run.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    So what are you having trouble with? Checking the other table, putting up the message or not running the query?

  5. #5
    Loc is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2013
    Posts
    27
    Yes, Checking the other table. The service recorded is linked via the work order number but just not understanding how to go out to the work order table find the work order number and check to see if the box is checked. I can do the message box and I think I will need a little help on the checking to see if the box is checked.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Here's a link on using DLookup() : http://access.mvps.org/access/general/gen0018.htm

  7. #7
    Loc is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2013
    Posts
    27
    So how would I use DLookup in an if then statement?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If Dlookup("YourFieldName", "YourTableName",) Then
    ...do stuff if True
    Else
    ...do other stuff if false
    End If

  9. #9
    Loc is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2013
    Posts
    27
    I tried this I keep getting an invalid argument what am I doing wrong?

    If DLookup("woComplected", tblWorkOrders, "woID=" & svrWOID) = -1 Then

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    All arguments to the Domain functions (DLookup, DCount...) are strings.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 06-06-2016, 06:05 PM
  2. Replies: 3
    Last Post: 09-12-2015, 10:16 AM
  3. Replies: 4
    Last Post: 06-20-2013, 10:26 PM
  4. Replies: 16
    Last Post: 03-13-2012, 03:47 PM
  5. Check Box status
    By NOTLguy in forum Forms
    Replies: 5
    Last Post: 11-27-2010, 08:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums