Duplicate record checking

S

Steve in MN

I have a form that i set up for duplicate record checking, but the code i
have is not working. I found something similiar to what i wanted to do and
modified it.
The form has bound field [SBOL #] and the table providing the information is
field [SBOL] it is a text field that has numbers and sometimes letters in the
prefix.

The code chokes out on the: rs.findfirst line with the following error.

Run time error 3070
Microsoft jet database engine does not recognize 'AAA342402401' as a valid
field name or expression.

What it does not recognize is the actual SBOL # that is in the text box on
the form that it is suppose to check for duplicates on.

any ideas?



Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb

Set rs = db.OpenRecordset("tblDeliveries", dbOpenSnapshot)
rs.FindFirst "[SBOL] = " & Me![SBOL #]

If rs.NoMatch Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "qappNewResponses"
Me![sfrmSdata].Requery
Else
MsgBox "This Survey # has already been keyed, please make sure it is
correct. ", vbOKOnly + vbExclamation, "Enter different Survey number . . ."

Me![SBOL #].Undo ' erase the input
Me![SBOL #].SetFocus
End If
Set rs = Nothing
End Sub
 

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