Combo box values

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I am trying to use a form to create and run a query. i
want the user to start out by selecting values from
combobox to be used as filters in a query. I am having
trouble figuring out how to store the value the user
selcts. I have the combobox set up but can't get an
event procedure to run (tried afterupdate and on change)
any help. I am getting an error "The expression On
CHange you entered as the evetn property setting produced
the following error: "Procedure declaration does not
match description of event or procedure having the same
name."
 
Chris said:
I am trying to use a form to create and run a query. i
want the user to start out by selecting values from
combobox to be used as filters in a query. I am having
trouble figuring out how to store the value the user
selcts. I have the combobox set up but can't get an
event procedure to run (tried afterupdate and on change)
any help. I am getting an error "The expression On
CHange you entered as the evetn property setting produced
the following error: "Procedure declaration does not
match description of event or procedure having the same
name."

That error message is pretty self-explanatory. You didn't post the
procedure declaration, but plainly it's not correct. Maybe you copied
and altered the procedure declaration for another event, which doesn't
have the same arguments. This is what an AfterUpdate event procedure
header should look like for a combo box named "cboMyCombo":

Private Sub cboMyCombo_AfterUpdate()

The Change event procedure would look similar, but I recommend that you
use the AfterUpdate event, as the Change event fires for every keystroke
a user types in the control.
 
-----Original Message-----


That error message is pretty self-explanatory. You didn't post the
procedure declaration, but plainly it's not correct. Maybe you copied
and altered the procedure declaration for another event, which doesn't
have the same arguments. This is what an AfterUpdate event procedure
header should look like for a combo box named "cboMyCombo":

Private Sub cboMyCombo_AfterUpdate()

The Change event procedure would look similar, but I recommend that you
use the AfterUpdate event, as the Change event fires for every keystroke
a user types in the control.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
Thanks. I am still getting the same message. My combo
box is called cbomediabox. The event procedure is

Private Sub cbomediabox_AfterUpdate()
Dim media As Variant
media = cboMediabox.Value
End Sub

I am pretty new to access but have some experince with
VBA in excel. I am sure it is something small but can't
figure it out.
 
Chris said:
Thanks. I am still getting the same message. My combo
box is called cbomediabox. The event procedure is

Private Sub cbomediabox_AfterUpdate()
Dim media As Variant
media = cboMediabox.Value
End Sub

I am pretty new to access but have some experince with
VBA in excel. I am sure it is something small but can't
figure it out.

Does the message you're getting now refer to the Change event or the
AfterUpdate event? If it still refers to the Change event, maybe you
didn't clear out the bad code? If you open the form in design view,
open the property sheet of the cbomediabox control, and go to the Event
tab, what is on the various event property lines?
 
Back
Top