newby question

R

ryan

What I am terying to do is have a field on a form that
when you enter some info it will check a table and ask
you if you want to add new or compare to others in the
table so that you do not get duplicates...if this makes
sense can somebody help me..

ryan
 
B

Bob Barnes

This is how I check it (using an Unbound Form).

The Button "cmdEntry" becomes Enabled only after the 4
fields below are entered.

Private Sub cmdEntry_Click()
Dim Z As Database, RS As DAO.Recordset, Q$
Set Z = CurrentDb
Q = "SELECT * FROM TheData WHERE (PDate = #" & TheDate _
& "# AND PGroup = " & GrIDDet & " AND PProc = " &
ProcIDDet _
& " AND PTeam = """ & GoTeam & """);"
Set RS = Z.OpenRecordset(Q, dbOpenSnapshot)
With RS
If .BOF Then
lblNewRec.Visible = True
Else
lblNewRec.Visible = False
End If
.Close: Set RS = Nothing: Z.Close: Set Z = Nothing
.. . . The existing data is then populated using code
End With
End Sub

HTH - Bob
 

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