Data Type mismatch error 3464 in Dlookup

M

mthornblad

Here is the code:

Private Sub id_Part_AfterUpdate()

strFilter = "pm_Part = " & Me!id_Part
Me!id_Unit = DLookup("pm_Retail", "Parts", strFilter)

End Sub

Hi.

I am getting error 3464 Data Type mismatch when I run this code.

The field id_Unit is on the form and is of the type Currency.
The field pm_Retail is in the Parts table and is of the type Currency.

The field id_Part is on the form.
The field pm_Retail is in the Parts table.

This seems simple enough but I can't figure out what the type mismatch
is.

I would appreciate any suggestions as to what the problem could be.

Thanks
Mark
 
O

Ofer Cohen

1. I can't see where you declare strFilter.
2. If the pm_Part field is text, then you need to add single quote before
and after the value in the criteria

Private Sub id_Part_AfterUpdate()
Dim strFilter As String
strFilter = "pm_Part = '" & Me!id_Part & "'"
Me!id_Unit = DLookup("pm_Retail", "Parts", strFilter)
End Sub
 
M

mthornblad

1. I can't see where you declare strFilter.
2. If the pm_Part field is text, then you need to add single quote before
and after the value in the criteria

Private Sub id_Part_AfterUpdate()
Dim strFilter As String
strFilter = "pm_Part = '" & Me!id_Part & "'"
Me!id_Unit = DLookup("pm_Retail", "Parts", strFilter)
End Sub

BS"D

Worked like a charm. Now I know.
Thanks so much for you help. I really appreciate it.

Mark
 

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