K
kharpe
I have a form with a button used to open a second form. The SQL code behind
the button opens an input box for user input of an "FCSI Number". When the
user enters a valid FCSI number, the second form opens correctly. There are
two instances during which I recieve an error. The first is if the user
cancels the input box, and the second is if no value is entered for the "FCSI
number"
Private Sub AddRemove_Click()
On Error GoTo Err_ADDRemove_Click
Dim DocName As String
Dim StCriteria As String
Dim stMsg As String
Dim stInput As String
DocName = "WPAddRemove"
stMsg = "Enter FCSI number"
'Prompt for input
stInput = InputBox(stMsg)
StCriteria = BuildCriteria("FCSI_ID", dbInteger, stInput)
StCriteria = StCriteria & "And " & "[Vessel_ID]=" & Me![Vessel_ID]
DoCmd.OpenForm DocName, , , StCriteria
Forms!WPAddRemove!WP_ID.DefaultValue = "" & Me![WP_Key] & ""
Exit_ADDRemove_Click:
Set rs = Nothing
Set qdf = Nothing
Set db = Nothing
Exit Sub
Err_ADDRemove_Click:
MsgBox Err.Description
Resume Exit_ADDRemove_Click
End Sub
The above is the code for the sub. If anyone can help me with capturing the
two errors it would be apreciated.
the button opens an input box for user input of an "FCSI Number". When the
user enters a valid FCSI number, the second form opens correctly. There are
two instances during which I recieve an error. The first is if the user
cancels the input box, and the second is if no value is entered for the "FCSI
number"
Private Sub AddRemove_Click()
On Error GoTo Err_ADDRemove_Click
Dim DocName As String
Dim StCriteria As String
Dim stMsg As String
Dim stInput As String
DocName = "WPAddRemove"
stMsg = "Enter FCSI number"
'Prompt for input
stInput = InputBox(stMsg)
StCriteria = BuildCriteria("FCSI_ID", dbInteger, stInput)
StCriteria = StCriteria & "And " & "[Vessel_ID]=" & Me![Vessel_ID]
DoCmd.OpenForm DocName, , , StCriteria
Forms!WPAddRemove!WP_ID.DefaultValue = "" & Me![WP_Key] & ""
Exit_ADDRemove_Click:
Set rs = Nothing
Set qdf = Nothing
Set db = Nothing
Exit Sub
Err_ADDRemove_Click:
MsgBox Err.Description
Resume Exit_ADDRemove_Click
End Sub
The above is the code for the sub. If anyone can help me with capturing the
two errors it would be apreciated.