Remember the Date

A

alex

Hello everyone,

Using Access ’03…

I have a form that contains a calendar (ActiveX Control). In the same
form is a subform linked to a table. I designed this form so that
users could open it, select a date, and enter stats such as counts and
hours.

This works fine, but I want to link the calendar date to the record
(with the same date) on the subform. For example, a user opens the
form, selects a date that does not exist in the table, and a blank
record opens (for data entry). Should the user select a date that
already exists in the table, that record would open on the subform and
the user could then edit it.

I thought about possibly adding VBA code to the calendar’s on click
that takes the calendar’s date and searches the table (form) for that
date…if it exists, pull the record, if not prepare the subform for
data entry.

Any thoughts?
alex
 
A

alex

Hello everyone,

Using Access ’03…

I have a form that contains a calendar (ActiveX Control).  In the same
form is a subform linked to a table.  I designed this form so that
users could open it, select a date, and enter stats such as counts and
hours.

This works fine, but I want to link the calendar date to the record
(with the same date) on the subform.  For example, a user opens the
form, selects a date that does not exist in the table, and a blank
record opens (for data entry).  Should the user select a date that
already exists in the table, that record would open on the subform and
the user could then edit it.

I thought about possibly adding VBA code to the calendar’s on click
that takes the calendar’s date and searches the table (form) for that
date…if it exists, pull the record, if not prepare the subform for
data entry.

Any thoughts?
alex

I'm doing some research and it appears that active X controls should
be avoided. I'm attempting to use Allen Browne's Popup Calendar to do
what I described above. I'd still take any suggestions in light of my
last post.

alex
 
K

Ken Sheridan

Alex:

Add an unbound text box, txtDateHidden, to the parent form. Set its Visible
property to false (No) to hide it. In the calendar control's Click event
procedure put:

Dim ctrl As Control
Set ctrl = Me.ActiveControl

Me.txtDateHidden = ctrl

Set the LinkMasterFields property of the subform control to:

txtDateHidden

and set its LinkChildFields property the name of the relevant date field in
the subform's underlying table. When you select a date in the calendar
control the subform should move to the record or records matching that date.
If no records match the date then it should move to a new record with the
selected date automatically placed in the relevant date field.

Ken Sheridan
Stafford, England
 
K

Ken Sheridan

Alex:

Provided the date is inserted into a control on the parent form, whether the
calendar is a pop up or within the parent form is irrelevant. The text box
can still be referenced as the LinkMasterFields property of the subform
control

Ken Sheridan
Stafford, England
 
A

alex

Alex:

Provided the date is inserted into a control on the parent form, whether the
calendar is a pop up or within the parent form is irrelevant.  The textbox
can still be referenced as the LinkMasterFields property of the subform
control

Ken Sheridan
Stafford, England







- Show quoted text -

Can't say thanks enough Ken!
Had one little problem in case others are following: had to change
Data Entry to No.
I have two other subforms (on the same form) that function the same
way. I'll try to do the same to them.

Thanks again,
alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top