Hi, I can't figure out the correct syntax to specify a multi-field key. The primary key of the table tblSegment is seg_projectID and seg_ContactID. I've tried separating the fields with commas and also tried using "&", but no luck. Here is a snippet of code:
Set myDB = CurrentDb()
Set myRS = myDB.OpenRecordset("tblSegment", dbOpenTable)
myRS.Index = "seg_projectID, seg_contactID"
myRS.Seek "=", Me!cont_projectID, Me!contactID
If myRS.NoMatch = False Then
myRS.Delete
strText = "Contact removed for project" & strProjectID
MsgBox (strText)
Me!cont_projectID = ""
myRS.Close
Else
MsgBox "Error detected. Segment record not found"
Undo
End If
Oh, I get Runtime error '3800' and 'seg_projectID, seg_contactID' is not an index in this table.
Any help you can provide would be appreciated. Thanks.
Set myDB = CurrentDb()
Set myRS = myDB.OpenRecordset("tblSegment", dbOpenTable)
myRS.Index = "seg_projectID, seg_contactID"
myRS.Seek "=", Me!cont_projectID, Me!contactID
If myRS.NoMatch = False Then
myRS.Delete
strText = "Contact removed for project" & strProjectID
MsgBox (strText)
Me!cont_projectID = ""
myRS.Close
Else
MsgBox "Error detected. Segment record not found"
Undo
End If
Oh, I get Runtime error '3800' and 'seg_projectID, seg_contactID' is not an index in this table.
Any help you can provide would be appreciated. Thanks.