J
John
I'm sure I'm not using the correct terminology, but
here's my question.
I have declared a public function. I have an afterupdate
event that triggers, and I want to execute the function
if a certain criteria is met, otherwise I want to go on
to do other things. I'm sure it's simple, but I usually
just use my public functions by putting =FunctionName
("data") in the event.
e.g.
I have a textbox. If the textbox = "s", I want it to
execute the function, otherwise I want to go ahead and
continue. Here's what I have:
Private Sub txtClient_AfterUpdate()
On Error GoTo err_clientUpdate
DoCmd.GoToControl "txtClientID"
DoCmd.FindRecord [txtClient]
DoCmd.GoToControl "txtClientID"
'Here's the part I need help with:
If txtClient="s"
run function SearchForm
resume exit_ClientUpdate
End If
If txtClientID <> txtClient Then
Forms!dlgerror.Caption = "Invalid Client Number"
Forms!dlgerror!txtTitle = "Invalid Client Number"
Forms!dlgerror!txtError = "The client number you
_entered does not exist. If you wish to add a
_new client, simply click the 'New' button. You
_can either click the 'Search' button or type
_an 's' into the clientID field to search for a
_specific client."
Forms!dlgerror.Visible = True
End If
exit_ClientUpdate:
Exit Sub
err_clientUpdate:
MsgBox "You have no clients currently entered into
the system.", , "Error!"
Exit Sub
End Sub
Thanks,
John
here's my question.
I have declared a public function. I have an afterupdate
event that triggers, and I want to execute the function
if a certain criteria is met, otherwise I want to go on
to do other things. I'm sure it's simple, but I usually
just use my public functions by putting =FunctionName
("data") in the event.
e.g.
I have a textbox. If the textbox = "s", I want it to
execute the function, otherwise I want to go ahead and
continue. Here's what I have:
Private Sub txtClient_AfterUpdate()
On Error GoTo err_clientUpdate
DoCmd.GoToControl "txtClientID"
DoCmd.FindRecord [txtClient]
DoCmd.GoToControl "txtClientID"
'Here's the part I need help with:
If txtClient="s"
run function SearchForm
resume exit_ClientUpdate
End If
If txtClientID <> txtClient Then
Forms!dlgerror.Caption = "Invalid Client Number"
Forms!dlgerror!txtTitle = "Invalid Client Number"
Forms!dlgerror!txtError = "The client number you
_entered does not exist. If you wish to add a
_new client, simply click the 'New' button. You
_can either click the 'Search' button or type
_an 's' into the clientID field to search for a
_specific client."
Forms!dlgerror.Visible = True
End If
exit_ClientUpdate:
Exit Sub
err_clientUpdate:
MsgBox "You have no clients currently entered into
the system.", , "Error!"
Exit Sub
End Sub
Thanks,
John