Check to see if a record exists

D

Dan

I have a database that keeps tracks of our members
information. When a record is inserted (on the form that
we use), by default the members status is "Active". I
have it so that when their status changes to "Account
Recievable" that it inserts a record into the "Accounts
Recievable" Table and when the status changes from
the "Accounts Recievable" Table that it deletes the
record. This is the code that I have:

If [Status] = "Account Recievable" Then

Dim strSQL As String
strSQL = "INSERT INTO [New AR Table] _
([Member Number]) " & _
"VALUES(" & Me.Member_Number & ")"

CurrentDb.Execute strSQL, dbFailOnError
Else
strSQL = "Delete FROM [New AR TABLE] WHERE _
([Member Number]) = " & _
Me.[Member Number]

CurrentDb.Execute strSQL, dbFailOnError
End If

What I need to do is have it check to see if the record
already exists in the table before it inserts or deletes
one of the records. [Member Number] is the primary key.
 

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