access forms

N

nishashanoj

hi
i want to get calendervalues in text box .that means when i click o
one date on calender it will appear in the start date text box
and i click on another date it will be in the end date text box..
can u please help me???????????
 
A

Al Camp

Try this...
Using the OnEnter for [Date1], by code, set a hidden text control called
[Location] on the form to "InDate1".
Using the OnEnter for [Date2], by code, set a hidden text control called
[Location] on the form to "InDate2".
Then select a date.
Use the Click event of the calendar (it doesn't show as an event in the
property box, but there is a Click event in the form module)

Private Sub Date1_Enter()
Location = "InDate1"
End Sub
--------------
Private Sub Date2_Enter()
Location = "InDate2"
End Sub
------------
Private Sub Calendar_Click()
If Location = "InDate1" Then
[Date1] = Calendar.Value
Location = ""
ElseIf Location = "InDate2" Then
[date2] = Calendar.Value
Location = ""
End If
End Sub

If you Tab into, or mouse into either field, and select a date from the
calendar, the appropriate field is updated. May need a bit of fine tuning
to suit, but I tested, and it seemed to work OK.
hth
Al Camp
 
Top