Q
Quintin
Hi,
I am wondering how a query can be performed at the moment
a next-form button is clicked. I think I need to add
something in the (Visual Basic) code that is behind the
button, but I am not really familiair with that. I want to
compare data that is filled in with a linked database. Who
can do some explaining ? Thanks a lot !
Note: this is what I have come up sofar, but it is not
working...
Private Sub Next_Click()
On Error GoTo Err_Next_Click
Dim stDocName As String
Dim stLinkCriteria As String
If [PatientLinked]![PATIENTID] <> [Patient]!
[PATIENTID] Then
MsgBox "PatienID is incorrect"
DoCmd.Close
Else
stDocName = "Subject number"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , ,
Me.Name
Me.Visible = False
End If
End If
Exit_Next_Click:
Exit Sub
Err_Next_Click:
MsgBox Err.Description
Resume Exit_Next_Click
End Sub
Quintin.
I am wondering how a query can be performed at the moment
a next-form button is clicked. I think I need to add
something in the (Visual Basic) code that is behind the
button, but I am not really familiair with that. I want to
compare data that is filled in with a linked database. Who
can do some explaining ? Thanks a lot !
Note: this is what I have come up sofar, but it is not
working...
Private Sub Next_Click()
On Error GoTo Err_Next_Click
Dim stDocName As String
Dim stLinkCriteria As String
If [PatientLinked]![PATIENTID] <> [Patient]!
[PATIENTID] Then
MsgBox "PatienID is incorrect"
DoCmd.Close
Else
stDocName = "Subject number"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , ,
Me.Name
Me.Visible = False
End If
End If
Exit_Next_Click:
Exit Sub
Err_Next_Click:
MsgBox Err.Description
Resume Exit_Next_Click
End Sub
Quintin.