queries with pulldowns

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

Guest

Can anyone help me??? I made a query, but I only want people to be able to enter criteria from a pulldown. I changed the field properties to what would be needed for this to work in a table or form, but it doesn't seem to be working with my query. Any ideas?
 
Hi,


Start the process by opening a form, with a combo box and, in the Change
event of the combo box, run, through your code, the query, using the combo
box value of the form.



Hoping it may help,
Vanderghast, Access MVP


Rawley said:
Can anyone help me??? I made a query, but I only want people to be able
to enter criteria from a pulldown. I changed the field properties to what
would be needed for this to work in a table or form, but it doesn't seem to
be working with my query. Any ideas?
 
I opened the combo box of the form, and found what I think is the Change event of the combo box that you are talking about. It was labeled 'On Change' and in the pulldown, had a [Event Procedure] listed. I don't understand the next party, with running the query through the code. Do I need to write in VBA? If so, can you give me any pointers? Also, I have a table with the employees listed, not a query. Do I need to make some type of a query that just lists all the employees??

Thanks!
 
Hi,



If it is an action query (Append, update, insert) you can use,
in the code of the AfterUpdate Event of the combo box, as example:

DoCmd.RunSQL "yourSavedQuery"

where your saved query refers to the parameter as
FORMS!YourFormName!YourComboBoxName, such as, in SQL view:

UPDATE myTable SET myField=22 WHERE
otherField=FORMS!myFormName!MyComboName



If it is a select query, use

DoCmd.OpenQuery "yourSavedQuery"

as example. Sure, it may be use as RowSource or even as RecordSource of
another form.



Hoping it may help,
Vanderghast, Access MVP


Rawley said:
I opened the combo box of the form, and found what I think is the Change
event of the combo box that you are talking about. It was labeled 'On
Change' and in the pulldown, had a [Event Procedure] listed. I don't
understand the next party, with running the query through the code. Do I
need to write in VBA? If so, can you give me any pointers? Also, I have a
table with the employees listed, not a query. Do I need to make some type
of a query that just lists all the employees???
 
Back
Top