Calling a form/Opening a form - basic

herby_one

Registered User.
Local time
Today, 01:28
Joined
Sep 30, 2004
Messages
22
When I open a form, I have a question asking what type of landlord will be entered. If the user selects 'No' I want to open another form.
This is my code, I'm just missing the correct syntax to call the Load_Form proc of another form.

Private Sub Form_Load()

Dim Msg, Style, Title, Ctxt, Response
Dim Confirmed As String
Dim Business As String
Msg = "Is this a private landlord?"
Style = vbYesNo + vbInformation '+ vbDefaultButton2 ' Define buttons.
Title = "Type of landlord"

Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
Confirmed = "Yes"
Else ' User chose No.
Business = "No" ' Perform some action.
Call Load_Business_Form????? End If

End Sub
 
You should put your logic inside the original form, before any of the second level forms load. Would this work?

???
kh
 
Code:
Private Sub Form_Load()

Dim Msg, Style, Title, Ctxt, Response
Dim Confirmed As String
Dim Business As String
Msg = "Is this a private landlord?"
Style = vbYesNo + vbInformation '+ vbDefaultButton2 ' Define buttons.
Title = "Type of landlord"

Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
Confirmed = "Yes"
Else ' User chose No.
Business = "No"
DoCmd.OpenForm("Business_Form")
EndIf
End Sub
 

Users who are viewing this thread

Back
Top Bottom