Dlookup Not working

Locopete99

Registered User.
Local time
Today, 02:37
Joined
Jul 11, 2016
Messages
163
Hi Guys,

Can you look at the below and let me know why this isnt working?

Other Dlookups of the same format are working but this one gets me a runtime error


Code:
Course = DLookup("[Level]", "[Tbl_Level]", "[ID]=" & Me![Course])

So the field Im looking for is Level on Tbl level.

The ID and Course fields are both number and course is the FK of the level table in the Tbl_Current table.

So i'm trying to find the course name by looking up where the ID field of Tbl_Level is the same as the Course field of Tbl_Current.
 
Hi Guys,

Can you look at the below and let me know why this isnt working?

Other Dlookups of the same format are working but this one gets me a runtime error


Code:
Course = DLookup("[Level]", "[Tbl_Level]", "[ID]=" & Me![Course])

So the field Im looking for is Level on Tbl level.

The ID and Course fields are both number and course is the FK of the level table in the Tbl_Current table.

So i'm trying to find the course name by looking up where the ID field of Tbl_Level is the same as the Course field of Tbl_Current.
I'd try :
Code:
Course = DLookup("Level", "Tbl_Level", "ID= " & Me.Course)
 
Hi Riti,

Thats one of the variations I have tried, didn't work.
 
Hi Riti,

Thats one of the variations I have tried, didn't work.
I'm using something like this too in my db and it works just fine

Code:
strCriteria = "[DeviceID]=" & Me![DeviceID]
DevInstr1Operator = DLookup("Operator", "tblDeviceDestrInsp1", strCriteria)

Hope it helps
 
Just in case it helps I've added screen grabs of both my tables in datasheet and design view
 

Attachments

  • Capture1.PNG
    Capture1.PNG
    19.6 KB · Views: 133
  • Capture2.PNG
    Capture2.PNG
    11.6 KB · Views: 139
Hi Riti,

Still not working for some reason.

Yet for instance I have another one that is working:

Code:
ID3 = DLookup("user", "tbl_User", "[CID]=" & Me![User])

Same basic format but one is working and one isnt and again bother CID and Me.User are number fields
 
Hi Riti,

Still not working for some reason.

Yet for instance I have another one that is working:

Code:
ID3 = DLookup("user", "tbl_User", "[CID]=" & Me![User])

Same basic format but one is working and one isnt and again bother CID and Me.User are number fields
check the naming probably...
Code:
Course = DLookup("[Level]", "[Tbl_Level]", "[ID]=" & Me![Course])
ambiguity with the name "Course" maybe?
 

Users who are viewing this thread

Back
Top Bottom