Issue with Dlookup- Help Please!

eocean234

New member
Local time
Today, 09:48
Joined
Mar 25, 2024
Messages
8
Hi I am new to access and trying to include a Dlookup in my coursework but I can't seem to get it working, I keep getting #Error. Its just to lookup a value in a table. Any help appreciated!:)
 

Attachments

  • Issue.png
    Issue.png
    21.8 KB · Views: 111
Only use alphanumeric characters and underscores in names. When you put spaces in them (Exam ID), it makes you need an additional step when working with them. That step is surrounding the name in brackets. So put brackets around Exam ID in the Dlookup ([Exam ID]). Or better yet, fix all your names to comply with the rule above.
 
Only use alphanumeric characters and underscores in names. When you put spaces in them (Exam ID), it makes you need an additional step when working with them. That step is surrounding the name in brackets. So put brackets around Exam ID in the Dlookup ([Exam ID]). Or better yet, fix all your names to comply with the rule above.
Hi thank you for the help but I am still a bit confused, I've tried and will insert below. I am still getting an error.
 

Attachments

  • issue2.png
    issue2.png
    9.3 KB · Views: 97
  • issue3.png
    issue3.png
    6.6 KB · Views: 98
Are your ExamID's text? Is 'Trinity' a value in ExamID? You need to treat text differently than numbers when you build the DLookup. You need to surround the value from the form in single quotes like so:

Code:
=Dlookup("Grade", "TblExam", "ExamID='" & Combo25 & "'")
 
That DLookup does not have a clue what Combo25 is. So:
=DLookUp("Grade","TblExam","[ExamID]=Forms![FORM NAME]![Combo25]")
 
Why use DLookup()? Is this required for the exercise?

Embedding full path in the criteria will work, until you decided to use form as a subform and then the path is no longer correct and gets more complex.

Also, domain aggregate functions can slow performance with large datasets.

Include Grade in the combobox RowSource then reference that column by its index. If Grade is in third column, its index is 2: =Combo25.Column(2)

Don't use spaces nor special characters in naming convention, nor reserved words as names. Also, give controls more meaningful names.
 
Last edited:
Hi I am new to access and trying to include a Dlookup in my coursework but I can't seem to get it working, I keep getting #Error. Its just to lookup a value in a table. Any help appreciated!:)
Why is the Combobox Unbound ?

Normally the table would have a field named GradeID - Number datatype.

Then you would have a separate table that lists all of the Grades.

On your form you would create a Combobox and you would lookup the value you want from the Grades Table.
 
Why is the Combobox Unbound ?

Normally the table would have a field named GradeID - Number datatype.

Then you would have a separate table that lists all of the Grades.

On your form you would create a Combobox and you would lookup the value you want from the Grades Table.
Search form?
 
That DLookup does not have a clue what Combo25 is. So:
=DLookUp("Grade","TblExam","[ExamID]=Forms![FORM NAME]![Combo25]")
I have tried this and the error message is gone but it appears blank
 
=DLookUp("Grade","TblExam","[ExamID]=" & Nz([Combo25], 0))
 
Hi back again, unfortunately I had to delete the table as I didn’t think I’d need it but now I do:(. So I’ve remade the table and form and now the dllook up only works when you try it once. Any help appreciated:))
 

Attachments

  • image.jpg
    image.jpg
    6.2 MB · Views: 87
  • image.jpg
    image.jpg
    5.9 MB · Views: 95
Can you provide db for analysis?
Follow instructions at bottom of my post.
 
Hi, I have it working now the problem was I had the combo box finding the values from another table or query instead of record on my form :)
I am now having problems with my DCount (sorry for being such a hassle) I wanted it to count the number of lessons that the member on my form is in but I am getting #Error. If anyone has any suggestions :)
 

Attachments

  • image.jpg
    image.jpg
    6.3 MB · Views: 99
You have your parameters backwards, if I read your prefixes correctly.
Lookup the syntax. :(
 
Yes you have it backwards with the table name first
should always count "*" not a field name

dcount("*","table or queryName",Criteria)
 

Users who are viewing this thread

Back
Top Bottom