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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime error 3464 in using dlookup or dcount 1

Status
Not open for further replies.

kennetha

Programmer
Sep 10, 2003
105
0
0
MT
Hi all,

I'm tring to use dcount or dlookup to verify an existing number in a table with no results. TransactionMain is the table-number is set to autonumber (table) and is the one to verify. a1 is an editbox on a form PickingNumbers.Code below;

If DCount("TransactionMain![number]", "TransactionMain", "TransactionMain![number]='" & Forms!PickingNumbers![a1] & "'") = 0 Then
MsgBox "Document no not found. "
Me.a1.SetFocus
Exit Sub
End If

Runtime error 3464! What wrong?
Thanks in advance
Kenneth
 
Since you say the a1 field is numeric, you need to remove the quotes (no delimiters for numerics, single quotes for text fields, and octothorpe (#) for dates)

Also, usually the table.field notation uses dot, not bang, but since you're picking from one table, I don't think there's any need for prefixing with table name.

[tt]If DCount("[number]", "TransactionMain", "[number]=" & Forms!PickingNumbers![a1]) = 0 Then[/tt]

You might need to ensure the control holds any information prior to the DCount, use for instance

[tt]If len(Forms!PickingNumbers![a1] & vbNullString) > 0 Then
' contains something
End If[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top