G
Guest
Hi
I don't know very much about VB so please be gentle with me!
I have a form with drop down selector list and then a command button which
opens another form with the record chosen from the drop down list. I created
the command button code using the wizard so looks like this
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "F_Delete Contact"
stLinkCriteria = "[Company Number]=" & Me![Choose Company]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OK_Click:
Exit Sub
Err_OK_Click:
MsgBox err.procedure
Resume Exit_OK_Click
This works fine but if the user just clicks the button without making a
selection comes up with standard error message. I'd like to replace this
message with a prompt that says 'You must select Company first' with an OK
button that then takes them back to the selection box. What's the best (and
easiest) way to do this please.
Thanks - Sheila
I don't know very much about VB so please be gentle with me!
I have a form with drop down selector list and then a command button which
opens another form with the record chosen from the drop down list. I created
the command button code using the wizard so looks like this
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "F_Delete Contact"
stLinkCriteria = "[Company Number]=" & Me![Choose Company]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OK_Click:
Exit Sub
Err_OK_Click:
MsgBox err.procedure
Resume Exit_OK_Click
This works fine but if the user just clicks the button without making a
selection comes up with standard error message. I'd like to replace this
message with a prompt that says 'You must select Company first' with an OK
button that then takes them back to the selection box. What's the best (and
easiest) way to do this please.
Thanks - Sheila