View Full Version : Combo Box- selecting option, opens a new form (long)


Pyro515
04-11-2000, 08:44 AM
This is my problem, I have a combo box with 3 options. One of the options I want to open a new form, the other 2 I just want to continue on with the form. I used an after-update, if then statement. I have included the source code below.


Private Sub Vehicle_Type_AfterUpdate()
If Vehicle_Type = "Company Owned" Then
DoCmd.OpenForm (Vehicle_Company_Owned)
Else: DoCmd.Close
End If
End Sub


The "elses" work great (I have them closing the form just for a test). The problem I run into is that when "company owned" is selected I get a run time error (listed below)

{Run-time error '2494'
The action or method requires a form name argument.}

Does anybody know what I am doing wrong??

Thank you in advance!!

Mike

Pat Hartman
04-11-2000, 01:02 PM
DoCmd.OpenForm "Vehicle_Company_Owned"

Did you check the help entry for syntax?

Pyro515
04-12-2000, 11:35 AM
Yeah, I used the auto help for the syntax & they showed it in (), but you are right, the VB help shows it in "" & that worked.

Thanks for your help!