If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
Correction:
This is probably not the only way to do it, but I would use a SQL statement with a separate recordset to check for the existence of the data and use the recordcount to determine whether to add the new record. e.g. Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("select * from TheTable where TheField = '" & Me.txtName & "'") If (rs.BOF And rs.EOF) Then ' Ensure the recordset is empty ' Insert the data (with add record or Append SQL statement) End If .... "Marvin" wrote: This is probably not the only way to do it, but I would use a SQL statement with a separate recordset to check for the existence of the data and use the recordcount to determine whether to add the new record. e.g. Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("select * from TheTable where TheField = '" & Me.txtName & "'") If Not (rs.BOF And rs.EOF) Then ' Insert the data (with add record or Append SQL statement) End If ... "Dennis" wrote: I have two fields on a form, First Name and Last Name. When the user clicks ADD NEW, I want his data entered to be checked against existing data. If BOTH fields match, he gets an error. Is there a clean way to do this using the DoCmd.GoToRec,,,acNewRec command? What would I need to use in conjunction with that command in order to do what I want? Thanks! |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I spell check locked form fields? | selzmank | General Discussion | 1 | January 12th, 2005 05:12 PM |
Relationship Help | Michael | General Discussion | 8 | October 14th, 2004 03:13 PM |
Duplicate Check | RUSS | Worksheet Functions | 4 | October 1st, 2003 11:11 PM |