How(link a calender control to a text box to except a date range)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

On the help topics list it says that you need to enter code "dtCriteria1 =
StartDteCalender.Value" to get the date that is selected in the calender to
the text box. Does anyone have any further details? Where does this code
need to go? How do I get the two to work together? Thanks
 
Hello,

You shall add the code to afterupdate event of the calender control.

Private Sub Calendar2_AfterUpdate()

Text0 = Calendar2.Value

End Sub

Best Regards,

Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=====================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
Assume the following --
Calendar form is named PFrmCalendar
Calendar is named MyCalendar
Textbox on form is named MyDate

Put the following code in the Open event of PFrmCalendar:
Me!MyCalendar.Value = Date()
Put the following code in the AfterUpdate evnt of MyCalendar:
Me.Visible = False

Create a button beside the textbox MyDate. Put the following code in the
Click event of the button:
DoCmd.OpenForm "PFrmCalendar",,,,,acDialog
If SysCmd(acSysCmdGetObjectState, acForm, "PFrmCalendar") <> 0 Then
Me!MyDate = Forms!PFrmCalendar!MyCalendar.Value
DoCmd.Close acForm, "PFrmCalendar"
End If

If you have two textboxes named StartDate and EndDate and you want to fill
both of them when the calendar opens, put the following code in the Click
event of the button:
DoCmd.OpenForm "PFrmCalendar",,,,,acDialog
If SysCmd(acSysCmdGetObjectState, acForm, "PFrmCalendar") <> 0 Then
Me!StartDate = Forms!PFrmCalendar!MyCalendar.Value
DoCmd.Close acForm, "PFrmCalendar"
DoCmd.OpenForm "PFrmCalendar",,,,,acDialog
If SysCmd(acSysCmdGetObjectState, acForm, "PFrmCalendar") <> 0 Then
Me!EndDate = Forms!PFrmCalendar!MyCalendar.Value
End If
End If
 
Back
Top