Simple I think

fenhow

Registered User.
Local time
Today, 14:47
Joined
Jul 21, 2004
Messages
599
Hi,

I have this code that pops up a Yes or No option. The yes option works fine but when I select No it closes my database?

Private Sub SFVINFen_GotFocus()

If Me.SFVINFen.ListCount = 0 Then
If MsgBox("VIN Does Not Exist! Would You Like To Continue With The New Order?", vbQuestion + vbYesNo, "VIN NOT FOUND!") = vbNo Then
Exit Sub
Else
Dim stDocName As String
DoCmd.OpenForm "Order Details", acNormal
DoCmd.GoToRecord , , acNewRec
Forms![Order Details].VIN.Value = Me.VinToFindFen
Forms![Order Details].ROFirst.Value = Me.FirstNameToFindFen
Forms![Order Details].ROLast.Value = Me.LastNameToFindFen

End If

End If


End Sub


Can someone please help?

Thanks.

Fen How
 
It would be easier to read if you had tabs in the statements. Do you have any errors on compile?

Toby
 
Hi,

I have this code that pops up a Yes or No option. The yes option works fine but when I select No it closes my database?

Private Sub SFVINFen_GotFocus()

If Me.SFVINFen.ListCount = 0 Then
If MsgBox("VIN Does Not Exist! Would You Like To Continue With The New Order?", vbQuestion + vbYesNo, "VIN NOT FOUND!") = vbNo Then
Exit Sub
Else
Dim stDocName As String
DoCmd.OpenForm "Order Details", acNormal
DoCmd.GoToRecord , , acNewRec
Forms![Order Details].VIN.Value = Me.VinToFindFen
Forms![Order Details].ROFirst.Value = Me.FirstNameToFindFen
Forms![Order Details].ROLast.Value = Me.LastNameToFindFen

End If

End If


End Sub


Can someone please help?

Thanks.

Fen How

When you select No, it closes this Sub. What were you expecting it to do?
 
I see that it closes the Sub but that wouldn't close the database as fenhow stated above.
 
First thing fenhow should do is remove the "Dim stDocName As String" as its no longer needed. :)
 

Users who are viewing this thread

Back
Top Bottom