Code trigger for form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a combo box on my form in which the user selects a three letter code
for a invoice transaction to identify it.I would like one of these three
codes to act as a trigger to automatically open another form.Is this
possible???
 
In the AfterUpdate event for the combobox, check what value the user's
selected and use DoCmd.OpenForm to open the other form if it's the correct
value.
 
Thanks Douglas,

Sorry, but where do you put this command??Is this done in a macro?For
example i have three codes...
RRM
RFD
RMY--------Once user selects RMY.....i would like form LowVal form to be
opened up.I see in the after update a selection of expression builder, code
builder and macro builder...How do i build this expression?
Thanks for your support....
 
Thanks Douglas,

Sorry, but where do you put this command??Is this done in a macro?For
example i have three codes...
RRM
RFD
RMY--------Once user selects RMY.....i would like form LowVal form to be
opened up.I see in the after update a selection of expression builder, code
builder and macro builder...How do i build this expression?
Thanks for your support....

Here is how, assuming the user can select 1 of 3 choices.

On the Combo Box property sheet, click on the Events tab.
On the AfterUpdate line write:
[Event Procedure]
Then click on the button with the 3 dots that will appear on that
line.
When the Code window opens, there will be two already existing lines
of code with the cursor flashing between them.
Write (between those lines):

Dim strForm as String
If Me!ComboBoxName = "RMY" Then
strForm = "LowVal"
ElseIf Me!ComboBoxName = "RPM" then
strForm = "AnotherForm"
Else
strForm = "YetAnotherForm"
End If

DoCmd.OpenForm strForm

Exit the code window.
 
Back
Top