S
Saul
I am creating a database with clients identified by a
client ID number (MRN). To view/enter data for a
particular client the user types in the client's MRN and
clicks "OK" which runs the following code created by the
wizard:
Private Sub cmdOpenfrmClientConfirm_Click()
On Error GoTo Err_cmdOpenfrmClientConfirm_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmClientConf"
stLinkCriteria = "[MRN]=" & "'" & Me![MRN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenfrmClientConfirm_Click:
Exit Sub
Err_cmdOpenfrmClientConfirm_Click:
MsgBox Err.Description
Resume Exit_cmdOpenfrmClientConfirm_Click
End Sub
If the client has not yet been entered into the database
(i.e., that MRN does not exit in the client table), the
code as written opens frmClientConfirm which is blank.
Instead, if the client is not yet in the database, I would
like to interrupt the code and display a message box
saying "this client has not yet been entered into the
database..." and ultimately direct the user to a form
designed to enter a new client into the database. What is
the best way to accomplish this. Thanks for your help.
Sual
client ID number (MRN). To view/enter data for a
particular client the user types in the client's MRN and
clicks "OK" which runs the following code created by the
wizard:
Private Sub cmdOpenfrmClientConfirm_Click()
On Error GoTo Err_cmdOpenfrmClientConfirm_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmClientConf"
stLinkCriteria = "[MRN]=" & "'" & Me![MRN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenfrmClientConfirm_Click:
Exit Sub
Err_cmdOpenfrmClientConfirm_Click:
MsgBox Err.Description
Resume Exit_cmdOpenfrmClientConfirm_Click
End Sub
If the client has not yet been entered into the database
(i.e., that MRN does not exit in the client table), the
code as written opens frmClientConfirm which is blank.
Instead, if the client is not yet in the database, I would
like to interrupt the code and display a message box
saying "this client has not yet been entered into the
database..." and ultimately direct the user to a form
designed to enter a new client into the database. What is
the best way to accomplish this. Thanks for your help.
Sual