Using the Right function in a dlookup

A

Alex

I am trying to lookup a field in a table and use the Right function at the
same time and I can't seem to get the syntax correct. Can someone please
help me? Thank you.

my code: If IsNull(DLookup("Orig_Qty", "Tm", Right("PRODUCTIONORDERID ='",
2) & Me![Work Order] & "'")) Then . . .

I need to compare only the two right characters in the productionorderid
field in the Tm table.
 
D

Dirk Goldgar

Alex said:
I am trying to lookup a field in a table and use the Right function at the
same time and I can't seem to get the syntax correct. Can someone please
help me? Thank you.

my code: If IsNull(DLookup("Orig_Qty", "Tm", Right("PRODUCTIONORDERID ='",
2) & Me![Work Order] & "'")) Then . . .

I need to compare only the two right characters in the productionorderid
field in the Tm table.


I'm not sure I understand. Do you want to match the rightmost 2 characters
of Tm.PRODUCTIONORDERID with the complete value of Me![Work Order] ? If so,
then I think this is what you want:

DLookup("Orig_Qty", "Tm", _
"Right(PRODUCTIONORDERID, 2) = '" & Me![Work Order] & "'")
 
A

Alex

Yes - thanks much. I thought I had tried that. Darn!!!

Dirk Goldgar said:
Alex said:
I am trying to lookup a field in a table and use the Right function at the
same time and I can't seem to get the syntax correct. Can someone please
help me? Thank you.

my code: If IsNull(DLookup("Orig_Qty", "Tm", Right("PRODUCTIONORDERID ='",
2) & Me![Work Order] & "'")) Then . . .

I need to compare only the two right characters in the productionorderid
field in the Tm table.


I'm not sure I understand. Do you want to match the rightmost 2 characters
of Tm.PRODUCTIONORDERID with the complete value of Me![Work Order] ? If so,
then I think this is what you want:

DLookup("Orig_Qty", "Tm", _
"Right(PRODUCTIONORDERID, 2) = '" & Me![Work Order] & "'")



--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top