Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dlookup

Status
Not open for further replies.
Jan 5, 2004
34
US
Hi,

I am trying to have a message pop up on a form if a criteria is met.

The the table to lookup criteria is not in the same domain.
query explained:
<<< IIF (DLOOKUP([form name].field, lookup table, look up field)=Yes),"Must Have State Mandated Application","")>>>


here is the query:
IIF (DLOOKUP([GRP_INVENTORY].St, LKup_State, Mandated Apps)=Yes),"Must Have State Mandated Application","")


Here is the error message:
Syntax error in the expression.

Thanks

Email Service Free from Banner ads.
 
IIF(DLOOKUP([GRP_INVENTORY].St, "LKup_State", "Mandated Apps='Yes'),"Must Have State Mandated Application","")

I assumed [GRP_INVENTORY].St is a field in the query, LKup_State is the name of the lookup table.

Just as a note, there's no msgbox to pop up a message. Also, you wanted a pop-up message on the form but using a query?
 
Also, I didn't quite understand what you're trying to do with the dlookup. I only corrected the syntax to the best of my knowledge.
 
The message to pop up is, "Must Have State Mandated Application", if the query is true.

Thanks I'll try out your sol.


Email Service Free from Banner ads.
 
Got this error:

Syntax eror in query expression '[IIF(DLOOKUP([GRP_INVENTORY]].[St, "LKup_State", "Mandated Apps='Yes'),"Must Have State Mandated Application","")]'.

Email Service Free from Banner ads.
 
You can't pop up a message through a query (not to my knowledge). You need to do this on the form.

In your form where you want to check your value, use the following...

If (condition) Then
MsgBox "Must Have State Mandated Application"
End If

I can't make out what you're trying to do with your DLookup. What is [GRP_INVENTORY].St? What is "MandatedApps"? What criteria are you looking for? Are you looking for records where St='Yes' or MandatedApps='Yes'? I just realized you're pulling a value from another table, GRP_INVENTORY?

DLookup("field", "Lookup table", "lookup field=" & criteria) is equivalent to "SELECT field FROM [Lookup table] WHERE [lookup field] = criteria"

Perhaps if you can provide a scenario I will have a better understanding of what you're trying to do. But I don't think using DLookup in a query is what you want.
 
This one finally worked!

Thanks everyone.

=IIf(DLookUp("[LkUp_State]![Mandated Apps]","[LkUp_State]","[LkUp_State]![St]=[Forms]![FrmGRP_INVENTORY]![St]")=Yes,"Must Have State Mandated Application","")


Email Service Free from Banner ads.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top