runtime error overflow problem

tho28199

Registered User.
Local time
Today, 08:25
Joined
Jan 25, 2007
Messages
28
Hi all,

I have tried to research this problem, but am coming up empty. I am getting a runtime error '6': Overflow when I attempt to run this code:

Private Sub txtLineNbr_BeforeUpdate(Cancel As Integer)

If DLookup("[txtEntryNumber]", "tblCDN_ImportsDetail", _
"[Entry Nbr] ='" & txtEntryNumber & "'") And _
DLookup("[txtLineNbr]", "tblCDN_ImportsDetail", "[Line Nbr] =" & Me.txtLineNbr) Then
MsgBox "This line number already exists for this entry...", vbExclamation
Cancel = True
Me.Undo
Exit Sub
Else
End If

End Sub

txtEntryNumber is a text field, while txtLineNbr is a numeric field.

tblCDN_ImportsDetail.[Entry Nbr] is linked to tblCDN_ImportsHeader.[Entry Nbr], and I can have multiple, but no duplicates, [Line Nbr].

In the input form, I want to check for a duplicate line item on the BeforeUpdate function, so that the user does not have to input all the other data only to find out that they have a duplicate line.

What am I doing wrong?
 
The overflow error is usually due to trying to assign a number larger than a numeric data type can hold. Try changing the data type of you numeric field to a long intger.
 

Users who are viewing this thread

Back
Top Bottom