Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with "ActiveX DaterPicker" 1

Status
Not open for further replies.

Ezeasy

MIS
Feb 7, 2002
37
0
0
US
Could someone help me use the “ActiveX Datepicker” to pass date to a query to select records based on the date selected?
Thanks in advance.
 
To use the date picker is fairly easy. insert the date picker on to the form. give the date picker a name or use the default name. create your query and in the primary field ( a date) enter the date picker name as the criteria for the query.
 
Craftsman61, thanks for your respond I tried that and I can not get it to work. This is what I put for my criteria Like [Forms]![form1]![ActiveXCtl0] & '*'. Do you see anything wrong.
 
Yes. When the user clicks on a date from the drop down calendar the date picker displays it thus it becomes the value of the date picker.

[Forms]![form1]![ActiveXCtl0]

try using just the above line as your query criteria. You don't need to use like or wildcards.
 
I tried it without the "like or wildcard" and still no success. Any other thoughts?
Thanks
 
I see what you mean hmm I use the date picker in a way that i have the user select a range of dates thus using two date pickers as a criteria for a query.

the criteria formula goes something like this

Between [Forms]![frmForm1]![txtDTPstart] AND [Forms]![frmForm1]![txtDTPend]

If you want me to i probably can get this worked out and get back to you tomorrow. Fixing to have a bunch of meetings for the next several hours.

 
I am back.

I tried at home last night to get a single date picker but to no avail. I have success in using two date pickers to select a range of dates.

Your problem maybe in the date format you are using in your table is different than what the date picker has.

It could be that someone more experienced than me with date pickers is needed here.

I will keep trying to come up with a solution while I am at work today. If I get something I will post it.

Sorry I could not be of more help with the date picker. Have you tried the Calendar Control ?

 
Try the calendar control to do this. I have tried it here with a temporary database and got it to work. The problem I keep running into with the date time picker is that it always includes a time. This is the problem. If you can figure a way around the time showing up with the date I'm sure that it will work. On the other hand the calendar control activeX component only returns the date. You just need to transfer its value to a textbox - a little on_click coding will easily do that, then base the query criteria on the textbox. Hope that helps, good luck !!
 
Craftsman61,
I looked into using calendar control but I liked the idea of the drop down box instead of showing the calendar on the form. And I double-checked the date format of my table and date picker and both are short date. Thanks again for your input.
 
Just a pointer,

I had the same problem with the Time and Date picker, but had success by taking the value of the Time and Date picker and getting just the date using the date value function, like:

'start code
Dim dtYourDate as Date

dtYourDate = DateValue(Me.DatePickerOcx.Value)

This will return 11/5/2002 instead of 11/5/2002 7:48:59 AM

Hope this helps
 
I had a text box set to equal the value of the date time picker. Even though the date time picker said just the date and its properties as well as the properties of the text box where set to short date the text box would still display the time.

It looks like 'BEEPS' just might have the work around here. I haven't tried it though. Good Luck !

 
Beeps,
I want to try you suggestion, where do I put this bit of code?
Thanks
 
If it's criteria for a query just put in your criteria field like:

DateValue([forms]![frmName]![dtPickDate].[value])

remember to change frmName to the name of your form and
dtPickDate to the name of your date picker.

I just tested this out and it works for me. Repost if having problems

 
Beeps,
Works great just what I was looking for thanks.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top