Results 1 to 3 of 3
  1. #1
    rkalapura is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York
    Posts
    69

    Macro and Dlookup() help

    Hai everybody,


    I am a new user of Access2010. I have two problems and really appreciate if anybody help me to sort those out:
    1. I have a conditional statement through a macro in the afterupdate event of a field in a form. I want to proceed to the next field only if the condition met (true) else need to exit without saving the record. What are the access 2010 macro command which I can use (a) to exit without saving the current record? (b) to go back to the first field in the form? I couldn't find anything in the list.

    2. I use Dlookup() function to display values in my form. When I use Dlookup() with one criteria it works, but wont work with combined criteria.
    Like Dlookup("[IRMaster]","[Kitmaster]","[KitID] = '"&[Forms]![Kitissue]![KitID]&"'") - This works.
    Dlookup("[IRMaster]","[Kitmaster]","[BrgPN] = '"&[Forms]![Kitissue]![BrgPN]&"'") - This also works.
    Dlookup("[IRMaster]","[Kitmaster]","[BrgPN] = '"&[Forms]![Kitissue]![BrgPN]&"'" and "[KitID] = '"&[Forms]![Kitissue]![KitID]&"'" ) This doesn't work. But record is available in the Kitmaster table to display with this combined criteria. Appreciate your help.

    Thank you and best regards

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    1. I don't know about macros, never use them - in VBA it is Cancel=True, maybe you can find a way to put that into a macro?

    2 - remove quotes around "and" - it should be one statement : "this='A' and that='B'"
    "[BrgPN] = '"&[Forms]![Kitissue]![BrgPN]&"' and [KitID] = '"&[Forms]![Kitissue]![KitID]&"'"

  3. #3
    rkalapura is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York
    Posts
    69
    Thank you very much for your help. Dlookup() works fine. Didn't try the other. Will come back if solved.
    Thank you once again. God Bless You

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

Similar Threads

  1. DlookUp
    By cap.zadi in forum Forms
    Replies: 5
    Last Post: 09-21-2011, 07:16 PM
  2. Help with DLookUp
    By focosi in forum Forms
    Replies: 10
    Last Post: 08-08-2011, 07:53 AM
  3. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  4. DLookup()
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 09-15-2010, 07:20 AM
  5. Form Dlookup macro
    By lukekelly in forum Forms
    Replies: 2
    Last Post: 01-20-2010, 06:24 AM

Tags for this Thread

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