Calendar

deejay_totoro

Registered User.
Local time
Today, 20:36
Joined
May 29, 2003
Messages
169
Hello,

I would like to use the calendar (v9) to let users input a start date and an end date.

I created the startdate field and the enddate field to the store the date information.

What I would like to happen is that the user clicks on a button, and a calendar form opens up. Then the user clicks on a date, clicks close, and the original form returns, with the start date entered. The same would happen for the end date.

How might I start to do this? (I dont know VB very well!)

One idea I had (which doesnt work!) was the following:

When the user clicks on the open calendar button, a new form opens. This form is based on the same table as the underlying form, so, I thought that if the only thing on this form was the calendar, then choosing a date here would store the data correctly. The date is indeed sent to the date field correctly, and when I return to the original form, the date is there. But for some reason, this only works with the first record! It doesnt work with subsequent records!

Any help would be greatly appreciated!

dj_T
 
Just to say: most of my calendar examples that I've posted to this forum use a form and a module that can simply be exported into your database.

From there, there's just a tiny bit of code that goes on the click event of each button you want to show the calendar.
 
Connect the date

Hello,

I'm not too good with VB.

In this case, how do I connect the date(s) selected with my start and end date fields?

dj_T
 
In fact, if the VB daunts you then this example is just what you want:

Just import the form and module into your database.

Look at the code on the Click of the buttons here - there is 2 lines per button and all you have to do is change the name of the textbox it puts the date into.
 

Attachments

Code help

Thank you for your help.

Im not sure where to insert the Start and End date field names.


cmdFrom has:

Private Sub cmdFrom_Click()
Me.txtFrom = Nz(Me.txtFrom, Date)
Call ShowCalendar(Me.txtFrom)
End Sub


and


cmdTo has:

Private Sub cmdTo_Click()
Me.txtTo = Nz(Me.txtTo, Date)
Call ShowCalendar(Me.txtTo)
End Sub


Which part do I change to refer to my start date field? How does the code know which table this field is on?

Thank you!

dj_T
 
Got it!

Hello,

Ah! The penny dropped.

I realised that I must copy the code to the buttons on my form.

Then it worked fine.

Thanks for the help. Much appreciated.

dj_t
 

Users who are viewing this thread

Back
Top Bottom