Unanswered: checking for Primary key consisting of 2 fields
I have a survey that is too large to fit on one table, so I've split it into 3 tables.
Each participant gets a unique identifier, but they are given the survey twice.
I have set the primary key for each table as the combination of the ID field and the TIMEPOINT field.
Once you reach the end of the first form I've created a button to open the second form and write the ID and Timepoint field into the 2nd table, however I'd like to check to see if a record already exists with that ID+TIMEPOINT when access goes to open the second field, since normally access will only alert you that the record cannot be saved because of a duplicate primary key after you have reached the end of a form.
currently I have the following vb to check to see if the ID already exisits, but I need to check to see if the primary key (ID+TIMEPOINT) already exists.
Private Sub gotoform2_Click()
On Error GoTo Err_gotoform2_Click
Dim stDocName As String
stDocName = "ParkinsonianDisability2"
If IsNull(DLookup("id", "ParkinsonianDisability2", "ID = Forms!ParkinsonianDisability1.ID")) Then
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Forms!ParkinsonianDisability2.ID = Forms!ParkinsonianDisability1.ID
MsgBox "This subject already has a record for next section, please investigate", vbCritical