Unanswered: How to query with a combo box with < and > criteria?
I'm doing a payroll interface now and I need to get the first half of the month(1-15) and the second half of the month(16-31) separately. I have an Access query that's already been created and now I need to get the combo box with the <=15 or >=16 values to put into the Access query criteria as [Form]![FormName]![Combo Box Name]. Month, day, and year is on a separate field but the day datatype of 'NUMBER.'
Originally posted by DoktorBlue
Just make a combobox with two items: "< 16" and ">= 16", and use the text property to form your query like:
"SELECT * FROM PayRoll WHERE Day " & Combobox.Text
You still need to specify your month and year.
Yes, I have already did the month and the year. I will not be hardcoding this in VBA. I"m just using the Access query(or whatever you call it, if there is a term for it, please tell me) to get my information for the report.
I have created a table for the days and it is bound to the second column. The DayText and DayValue field datatype is set to 'TEXT'.
In the combo box, I display the first column(DayText) and bound it to the second column(DayValue) when the user click on it.
In the Acess query with the Day column for the criteria I put [Forms]![ExpenseForm]![cboDay]
I'm sorry, I don't have that amount of time. It's easier when you post your query as SQL as far as you tried. Also post your error message or whatelse happened. I will find out what you did wrong, since my method should work.
Make everything as simple as possible, but not simpler! - A. Einstein
DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool
I use your method and add a field to it when it is true. Since this only show the value -1(yes) and 0(no). I have to query all of the 0 out and also added the day field into the query so it would display the day of the record.