Change Number to Text in Table

S

spadasak

I have a form where I track custody of wood. The client enters a
registration mumber which pulls up the associated company. The numbers are
now alphanumeric and when I changed the table entry from number to text the
form no longer recognizes the either. Here is the code: Any help would be
appreciated.

Private Sub CustodyNumber_AfterUpdate()
Dim CustodyValid As Variant
CustodyValid = DLookup("CustodyName", "ChainOfCustody", "CustodyNumber = " &
CustodyNumber)
If IsNull(CustodyValid) Then
MsgBox "Invalid Custody Number, Certification denied"
check2.Value = False
CustodyName.Value = ""
Call cmdOK_Click
Else
CustodyName.Value = CustodyValid
End If
End Sub
 
D

Dennis

Now that the CustodyNumber is alphanumeric, you need to put single quotes
around it like so
CustodyValid = DLookup("CustodyName", "ChainOfCustody", "CustodyNumber = '" &
CustodyNumber & "'")
 

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

Top