Query filtering using unbound text box

gwenise

New member
Local time
Yesterday, 22:37
Joined
Nov 20, 2013
Messages
5
I have some filtering criteria in a query that is based on some unbound text boxes in a form. These text boxes contain start and end dates. This form is not based on any table or query. All controls are unbound.

The query functions properly initially, however, I am programmatically changing the values of the unbound text boxes in the form that are used by the query. After their values have changed, the query doesn't seem to recognize the change and therefore returns no values.

If I manually change the the values in the text boxes and run the query it works fine. However, I would like to avoid doing it this way, if at all possible.

After programmatically changing the values of the unbound text boxes, I tried setting the focus to the text boxes, setting the focus to other controls, refreshing the form, requering the form, requerying the text box, so forth and so on.:banghead:

Any thoughts on what I could do here?
 
What date format do you use when you enter manually?
Can you show us the code that changes the values in the text boxes?
 
There is access you need to take care while in date format, it queries with mm/dd/yyyy i.e american format, If you setup your query with mm/dd/yyyy then it will execute the result.
 
Last edited:
Well I ended up changing one of the unbound text boxes to a combo box with the date entries I need then when the combo box value changes it triggers a change in the other text box. This is actually working although I didn't really want to have to do it this way. The combo box's data come from a table I created with the dates I need in it.

Originally this was the code I was using to change the text in the text boxes:

Me.txtSumStartDate = CVDate(MonthNumber & "/1/" & YearNumber)
If MonthNumber = 12 Then
YearNumber = YearNumber + 1
MonthNumber = 1
Else
MonthNumber = MonthNumber + 1
End If
Me.txtSumEndDate = CVDate(MonthNumber & "/1/" & YearNumber)

This changed the text just fine. Only my query would not recognize the change.
 
I spoke too soon. Again it is not working.:banghead:

Strange because it worked yesterday.....

I ran the compact and repair utility, but still not working.
 
What exactly do you mean by not working?

THat's not very helpful. Any error messages???
 
Many months later and I finally figured out my issue.
Even though I want to send various date values to my query, I cannot send them as actual date values, but as text. After I changed the format of my text boxes from date values to just text, every thing worked out fine.

These itty bitty things one must know....
 

Users who are viewing this thread

Back
Top Bottom