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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting Dates By Using ActiveX Object "Calendar 8.0" 2

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hey everyone. I'm creating a program that keeps track of employees times. I was wondering how do I go about using the Calendar to select inbetween dates. I inserted an ActiveX Object 'Microsoft Calendar 8.0' and it only allows me to select one date at a time. What I wanted to do was allow the user to select inbetween dates so if they worked from September 15 - September 18 '02 they can just look at the calendar and select the range of dates with their mouse. If anyone knows how to do this or can direct me to a place that has an example w/code etc...that would be great :) Thanks


L
 
One of the Northwinds example databases has a good example of how to do this using the calandar.

A quick fix is to create a query and add the following to the criteria of the date you want to search between.

Between[Enter Start Date] and [Enter End Date]

Then either just run the Query or build a report based on this query. It will open up a message box asking for the start date and the end date. Enter these and bingo.

Hope this helps, let me know
Rob
 
I checked out northwinds and there were no examples? Can anyone help!! Please
 
This should work.

On the form with the calandar call the Calandar

SelectDate

add 2 unbound text boxes, call them:

BeginningDate
EndingDate

Then add a button to the form (called SetDate). In the on Click Procedure add the following code

Private Sub SetDate_Click()
On Error GoTo SetDate_Error

If SetDate.Caption = "Set Beginning Date" Then
BeginningDate = SelectDate.Value
SetDate.Caption = "Set Ending Date"
Else
EndingDate = SelectDate.Value
SetDate.Caption = "Set Beginning Date"
End If

Exit Sub

SetDate_Error:
MsgBox err.Description
Exit Sub


End Sub

Then open the query you want to base your report on and add the following to the date Criteria

Between [Forms]![Your Calandar Form]![BeginningDate] And [Forms]![Your Calandar Form]![EndingDate]

Then build a report based on this query, and add a button to the Calandar form to open the report.

When you use the form you would choose the start date, and click the beginning date button, this then chages to the ending date button, choose the end date and press the button and then preview the report.

Hope this is what you were looking for, let me know if it helps
Rob!
 
Hello! I can't find Microsoft Calendar 8.0 and I can't find out how to bring up the dialog box with the list of components you can add to access (like directx etc.) any ideas?
 
Click the toolbox button on the standard toolbar, neillovell. The "Hammer & Wrench"-Button.
 
Nope not on there. I'm using Access2002 is it included with this version?

Don't I have to add it in from the dialog box with the checkboxes?
 
I used microsoft date and time picker, but when I run the query (by pushing the button to open the report) I get a dialog box prompting for the Forms![CalendarForm] etc. values.
 
Ah, I spelt calendar wrong. DOH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
Rob I used your code effectively, and decided to pop it in to my other form which displays rows of data from a table. However, each date field and the confirmed time unbound text box now display the same information. When I create a new record or change an existing record all the dates match what I've just entered. Previously I used a drop down menu that referenced a table of dates that I typed in myself.

Any thoughts?
 
I Neil,

Not sure what your form does. It may be worth your while starting a new thread.

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top