Should be an easy question to answer

pdbowling

Registered User.
Local time
Today, 02:08
Joined
Feb 14, 2003
Messages
179
Hi, all.
I have a form with a comboBox on it. It has two choices. When I choose one I need it to run a particular macro. The macros do not launch as is. What is wrong with my code?


Private Sub Combo42_OnChange(Cancel As Integer)
If Combo42.SelText = "Cost Center Sort" Then
DoCmd.RunMacro (CostCenterSort)
ElseIf Combo42.SelText = "Cost Center Filter" Then
DoCmd.RunMacro (CostCenterQuery)
End If
End Sub

I set it up as unbound with "Cost Center Sort" and "Cost Center Filter" as the choices.
Thanks everyone.
PB
 
Put the macro names in inverted commas

DoCmd.RunMacro "CostCenterSort"
 
hmmm

Thanks. I also had to change Combo42_OnChange to
Combo42_BeforeUpdate. This seems counter intuitive to me. Anyone know why OnChange isn't the correct choice?
PB
 

Users who are viewing this thread

Back
Top Bottom