How Can I Valid A Compound Key With Dlookup Function

CMontoro

Registered User.
Local time
Today, 12:49
Joined
Mar 26, 2005
Messages
21
In a form named PRODUCTION there are 3 text box for invoice data: xtype, xserie, xnumber

I need valid this data from the INVOICE table, where its key is a compound key (TPINV+SERINV+NUMINV)
I tried with

Private Sub xnumber_AfterUpdate()
Dim searchinv as string
searchinv=Dlookup("*","[Invoice]", [tpinv]="& Forms![production].[xtype] and [xserie]= &Forms![production].[xnumber] and "&Forms![xnumber]
If searchinv ="" then
MsgBox ("Invoice doesn't exist'")
Cancel = True
End If
End Sub

... but it doesnt work
Please help me

Thanks in advance
CM
 
Your opening and closing of quotes around the form references is completely goofed up (and the formula looks incomplete at the end). Here's a reference you may find helpful, particularly the example of a multiple criteria lookup at the end.

http://www.mvps.org/access/general/gen0018.htm
 

Users who are viewing this thread

Back
Top Bottom