> That helps. I want the input box to close when the cancel button is
> pressed,
> but to re-open if no Value is entered, but the OK button is pressed. Is
> there
> a method that I can differentiate between which oft the two buttons is
> pressed on the input box?
>
> "Douglas J. Steele" wrote:
>
>> It's the same check for both errors:
>>
>> 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)
>> If Len(stInput) = 0 Then
>> MsgBox "You must spupply an FCSI number."
>> Else
>> 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] & ""
>> End If
>>
>> 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
>>
>>
>>
>>
>> --
>> Doug Steele, Microsoft Access MVP
>>
http://I.Am/DougSteele>> (no private e-mails, please)
>>
>>
>> "kharpe" <kharpe[ at ]discussions.microsoft.com> wrote in message
>> news:40189CC2-4875-4723-87D9-4CBFAD305CF0[ at ]microsoft.com...
>> >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"
>> >
>> > The above is the code for the sub. If anyone can help me with capturing
>> > the
>> > two errors it would be apreciated.
>> >
>>
>>
>>