newby question

  • Thread starter Thread starter ryan
  • Start date Start date
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
 
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
 
Back
Top