Results 1 to 8 of 8
  1. #1
    jbedward is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Dec 2009
    Posts
    6

    Smile Subform Dlookup

    I have successfully written a DLookup in the control source Properties table of a subform when I open the subform directly from the Forms Objects site, but when I open the form and look at the subform at the bottom of the forms page, the DLookup gives me an error. Any ideas would be greatly appreciated! This is the formula if it helps:


    =DLookUp("Primary_Price","CDM_test","Charge_Code ='" & Forms!INDY_SUB!CDMwSCD & "'")

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    SubForms are not listed in the Forms collection, only MainForms. Try:
    =DLookUp("Primary_Price","CDM_test","Charge_Code ='" & Me.CDMwSCD & "'")

  3. #3
    jbedward is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Dec 2009
    Posts
    6
    thanks for trying, but that didn't work

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I assume the Charge_Code is a text field. Does the SubForm still work by itself?

  5. #5
    jbedward is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Dec 2009
    Posts
    6
    Yes, Charge_code is text, and the Subform still works.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is it a specific error or just "#Error"? It should work unless there is something else going on. Any chance of posting a db that exhibits the issue?

  7. #7
    jbedward is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Dec 2009
    Posts
    6
    the error is #Error I'm sorry, but I don't know what a db is!

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    db = Database. Could it be you are getting the error when there are no records in the RecordSource of the form? Can you Compact and Repair and then ZIP up a sample we can play with? It would probably help.

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

Similar Threads

  1. Dlookup Lookup Value
    By WhatnThe in forum Access
    Replies: 14
    Last Post: 12-30-2009, 11:45 PM
  2. Dlookup problem
    By CalifDan in forum Reports
    Replies: 4
    Last Post: 12-09-2009, 06:09 AM
  3. Dlookup
    By janjan_376 in forum Access
    Replies: 20
    Last Post: 07-07-2009, 07:40 AM
  4. Dlookup question
    By nkenney in forum Forms
    Replies: 3
    Last Post: 07-01-2009, 06:36 PM
  5. Need Help for Dlookup function
    By wasim_sono in forum Programming
    Replies: 5
    Last Post: 01-04-2006, 08:18 AM

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