hi..
how to write a query which accept date from the form and based on that date display the result.
In a form I am selecting a date value through calander.I am working on access 2003 and vba.
thanks
hi..
how to write a query which accept date from the form and based on that date display the result.
In a form I am selecting a date value through calander.I am working on access 2003 and vba.
thanks
Sounds like you want a parameter query.
[VBA]
Set parameter xDate Date/Time;
Select * From Table1 Where Date = [xDate]
[/VBA]
Or if you are trying to get the date from existing data
[VBA]
Select * From Table1 Where Date = Forms![frmName].dateField
[/VBA]
Someday I'll understand everything...
Even then...I'll still pretend I'm a beginner.
hi..
I dont know about the parameter query.But problem is like that.
Lut US take example...I am pike up the date from calander and there is condition if date is "<" it will display only the record which is less then the selected date.Like that i have all the condition(<,>,=,<=,>=).
I need to write the query for that but i dont have any idea.
Please help me solve this.
thanks
Perhaps you could do it on the After_update sub for the date field. So when you click the calendar you get the date entered in the field. This fires the after_update event.
so
set the filter to Filter = Date < DateField
Then turn the filter on.
Someday I'll understand everything...
Even then...I'll still pretend I'm a beginner.
Sorry no idea about what u said.can you please tell me the steps how to do that .what query I should write in vba editor .
one more thing is that i have a dropdown from that we are accepting a value either "<","<=","=" etc how to set one conditional operator is default in that dropdown box.
thanks for your help....
So imagine you have a sample form that follows the format below;
____________________________________________________________
----------------------------TITLE OF FORM--------------------------
lblID txtID lblCompanyAddedOn dteIN
lblCompany txtCompanyName lblCriteriaFilter txtDateFilter
____________________________________________________________
Right click on the field that you have set to be the filter or criteria (in this example txtDateFilter).
Click on the Event Tab and click the [...] button on the row that says, "After Update", select Code. You will be brought to the VBE. There enter the following code.
(based on the example I drew up)
[VBA]
Private Sub txtDateFilter_AfterUpdate()
Me.Filter = "dteIn < " & txtDateFilter
Me.FilterOn = True
End Sub
[/VBA]
That should do it.
Last edited by Imdabaum; 07-15-2010 at 08:56 AM.
Someday I'll understand everything...
Even then...I'll still pretend I'm a beginner.