DLookup with string

junyor

Registered User.
Local time
Today, 08:33
Joined
May 28, 2008
Messages
18
Hi everybody!

I have another problem:

I have a table (Contas) whitch has two columns: Conta / Nome.
The data type for conta is text (it will accept exactly 20 numbers)

The problem is that using the Dlookup function a message appears saying:
"Datatype mismatch in criterian expression."

If Not IsNull(DLookup("nome", "contas", "conta = " & Str(Me.txtverifica))) Then
Nome = DLookup("nome", "contas", "conta = " & Me.txtverifica)
Else
DoCmd.GoToRecord , "Contas_Segmentation", acNewRec...
end if

Does anyone know how i can use this function with a string?

Tks,
 
I think you may need to put quotes in:

If Not IsNull(DLookup("nome", "contas", "conta = '" & Str(Me.txtverifica) & "'" )) Then

???
 
I think you may need to put quotes in:

If Not IsNull(DLookup("nome", "contas", "conta = '" & Str(Me.txtverifica) & "'" )) Then

???

Sorry for my inattention!!!!

Thank you!!!
 

Users who are viewing this thread

Back
Top Bottom