Dlookup Not working (1 Viewer)

Locopete99

Registered User.
Local time
Today, 02:20
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.
 

riti90

Registered User.
Local time
Today, 10:20
Joined
Dec 20, 2017
Messages
44
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)
 

Locopete99

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

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

riti90

Registered User.
Local time
Today, 10:20
Joined
Dec 20, 2017
Messages
44
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
 

Locopete99

Registered User.
Local time
Today, 02:20
Joined
Jul 11, 2016
Messages
163
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: 74
  • Capture2.PNG
    Capture2.PNG
    11.6 KB · Views: 75

Locopete99

Registered User.
Local time
Today, 02:20
Joined
Jul 11, 2016
Messages
163
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
 

riti90

Registered User.
Local time
Today, 10:20
Joined
Dec 20, 2017
Messages
44
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?
 

Locopete99

Registered User.
Local time
Today, 02:20
Joined
Jul 11, 2016
Messages
163
Thanks Riti,

Turns out it didnt like the string name
 

Users who are viewing this thread

Top Bottom