Results 1 to 5 of 5
  1. #1
    ozziestockton is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    2

    Dlookup returning #Error

    I'm new to forms and am revamping a company database. it's a small database and i just want to populate enrollment automatically after the user selects a school district from a drop down. Enrollment is just in another table, so it seems like it should be easy, but I can't figure it out. I get #Error in the text box. I've googled to death with no fix.



    This is what I have in the Control Source:

    =DLookUp("ReportedEnrollment","dbo_Tasb_Account_Vi ew","Account = " & [Forms]![Data Entry Form]![DistrictID])

    I have Office 2010, but this database is still an .mdb (could that be a problem?)

    Also the table I am linking to is from a dbo connection, so not sure if that might be a problem for some reason.

    Thanks for your help!

  2. #2
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    =DLookUp("ReportedEnrollment","dbo_Tasb_Account_Vi ew","Account = " & [Forms]![Data Entry Form]![DistrictID])

    there's a space in your table name...is that right?

    I don't think DLOOKUP is real time. hence, you have to refresh the form if the lookup performed when the record loads IS actually an error.

    dlookup is also a terrible function. probably the least favorite of many access developers. It is slow and it's not useful in many scenarios at all. I would code this behind the AFTERUPDATE() event of your drop box. it's one line of code, done. you also don't have to deal with the form's properties. they're not always on your side. sometimes they just plain suck, too.

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is Account Numeric or Text? You are treating it as Numeric.
    If it is Text then you will need ","Account = '" & [Forms]![Data Entry Form]![DistrictID] & "'")

  4. #4
    ozziestockton is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    2
    Thanks Rural. That fixed it. Now I will see if I can actually get this to write to the table. Thanks again!

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Glad we could help.

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

Similar Threads

  1. Function returning Error 91 (can't Figure out)
    By FrustratedAlso in forum Access
    Replies: 2
    Last Post: 04-17-2012, 02:55 PM
  2. Blank Field returning #Error
    By imintrouble in forum Access
    Replies: 8
    Last Post: 12-09-2011, 03:00 PM
  3. Replies: 1
    Last Post: 10-20-2011, 07:37 AM
  4. IIF Statement Returning #Error
    By DrDefpoints in forum Queries
    Replies: 6
    Last Post: 05-26-2011, 12:25 PM
  5. Replies: 10
    Last Post: 05-19-2010, 10:34 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