Why the bookmark? Are you using the recordset anywhere else?
To find out whether the record already exists, use DLookup or DCount, or
open a recordset specific to your search criteria:
Dim cvjoinspec As String
Dim mytest As Integer
cvjoinspec = "[index_groups]=2 AND [index_persons]=8"
If IsNull(DLookup("FieldName", "joins_group_person", cvjoinspec)) = True
Then
' record doesn't exist
mytest = 0
Else
' record exists
mytest = 1
End If
or
Dim cvjoinspec As String
cvjoinspec = "[index_groups]=2 AND [index_persons]=8"
If DCount("*", "joins_group_person", cvjoinspec) = 0 Then
' record doesn't exist
mytest = 0
Else
' record exists
mytest = 1
End If
or
Dim cvdb As Database
Dim cvjoinrst As DAO.Recordset
Dim mytest As Integer
Dim strSQL As String
strSQL = "SELECT * FROM joins_group_person " & _
"WHERE [index_groups]=2 AND [index_persons]=8"
' specify the database
Set cvdb = currentdb()
' open the join table
Set cvjoinrst = cvdb.OpenRecordset("strSQL")
If cvjoinrst.BOF And cvjoinrst.EOF Then
mytest = 0
Else
mytest = 1
End If
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Don Starnes" <DonStarnes@discussions.microsoft.com> wrote in message
news:4496098C-A0AA-4427-8FF8-30E007601C73@microsoft.com...
|