Create query through code with 2 or more parameters.

yxqzme2

New member
Local time
Today, 07:46
Joined
Mar 31, 2008
Messages
3
I am working on a DB that will help me sort data by dates and shift.
i can get the code to create the query to select multiple dates OR sort tby shift. I really need it to sort both with one button. i am sure this is easily done and i am just using the wrong code.
i have uploaded a sample with working buttons. please help.
i know there is alot of unneeded code in the shift command button, i didnt have time to clean it up
Thanks in advance
 

Attachments

I am working on a DB that will help me sort data by dates and shift.
i can get the code to create the query to select multiple dates OR sort tby shift. I really need it to sort both with one button. i am sure this is easily done and i am just using the wrong code.
i have uploaded a sample with working buttons. please help.
i know there is alot of unneeded code in the shift command button, i didnt have time to clean it up
Thanks in advance

I don't quite understand what you're trying to do. I looked at your code --what is the reference to Counties?
Why are there 2 Run Query buttons?
Why is Date a text field?
Be cautious of using Reserved words for Field names.

You will need to get the values of controls along the following liine:
Code:
strWhere = " WHERE (((WireUse.Shift)='" & [Forms]![frmMultiSelect]![Frame24] & "'));"


Perhaps you can better describe what you are trying to do.
 
Last edited:
General comments:
- Dont use reserved words (agreeing with JDRAW)
- Dont use
Special characters (%#) and/or spaces anywhere in any names

As for your question you are going to have to use the "Order by" of a query.
If you made this, that should be easy to do... If not try ordering the query your self, look at the SQL and see what you need to change to make it work like you want it to.
 
better explaination

I will try to clear up some things here
First, some of this code is canabalized from an exaple i got online, hence the lstcounties. i just changed where the list box got its data and it worked.
there are 2 buttons because i was showing that i can get either the dates i want selected OR the shift i want.
now what i am trying to do is this: i need to make one button create a query that will select certain dates selected from the list box, and which shift is selected from the option group. so if i want the 1st, 2nd, and 8th data for shift one, i get that.
hope this helps.
 

Users who are viewing this thread

Back
Top Bottom