Sorry, I am not following what you described.
Do you have a TextBox bound to the Date as well as a
Calendar Control bound to the Date Field?
I normally only have a TextBox bound to the DateField and
a CommandButton to open a Dialog Form with only the
unbound Calendar Control + a "Select" CommandButton. The
code for the CommandButton to open the Calendar Form:
****
Private Sub cmdFromDateCal_Click()
'================
' Form_frmPrePivot_LL.cmdFromDateCal_Click
'--------
' Purpose:
'--------
' Notes :
'--------
' Parameters:
'
'--------
' Called Subs/Functions
' (none)
'--------
' Calling Subs/Functions
' (none)
'--------
' Returns:
' (none)
'--------
' Author : Van T. Dinh, Thursday, 5 June 2003
'--------
' Revision History
' Thursday, 5 June 2003 (VTD):
'================
On Error GoTo cmdFromDateCal_Click_Err
DoCmd.OpenForm "frmCalendar", , , , , acDialog, "Select
Results From"
Me.txtFromDate.Value = Forms!
frmCalendar.acxCalendar.Value
DoCmd.Close acForm, "frmCalendar", acSaveNo
cmdFromDateCal_Click_Exit:
Exit Sub
cmdFromDateCal_Click_Err:
Select Case Err.Number
Case 0
Case Else
MsgBox "Error " & Err.Number & ": " &
Err.Description & vbCrLf & vbCrLf & _
"(Programmer's note:
Form_frmPrePivot_LL.cmdFromDateCal_Click)" & vbCrLf, _
vbOKOnly + vbCritical, "Run-time Error!"
End Select
Resume cmdFromDateCal_Click_Exit
End Sub
****
which actually assigns the Calendar date value to the
TextBox.
The code in the Calendar Form for example:
****
Private Sub acxCalendar_DblClick()
'================
' Form_frmCalendar.acxCalendar_DblClick
'--------
' Purpose:
'--------
' Notes :
'--------
' Parameters:
'
'--------
' Called Subs/Functions
' (none)
'--------
' Calling Subs/Functions
' (none)
'--------
' Returns:
' (none)
'--------
' Author : Van T. Dinh, Friday, 27 June 2003
'--------
' Revision History
' Friday, 27 June 2003 (VTD):
'================
On Error GoTo acxCalendar_DblClick_Err
Call cmdSelect_Click
acxCalendar_DblClick_Exit:
Exit Sub
acxCalendar_DblClick_Err:
Select Case Err.Number
Case 0
Case Else
MsgBox "Error " & Err.Number & ": " &
Err.Description & vbCrLf & vbCrLf & _
"(Programmer's note:
Form_frmCalendar.acxCalendar_DblClick)" & vbCrLf, _
vbOKOnly + vbCritical, "Run-time Error!"
End Select
Resume acxCalendar_DblClick_Exit
End Sub
Private Sub cmdSelect_Click()
'================
' Form_frmCalendar.cmdSelect_Click
'--------
' Purpose:
'--------
' Notes :
'--------
' Parameters:
'
'--------
' Called Subs/Functions
' (none)
'--------
' Calling Subs/Functions
' (none)
'--------
' Returns:
' (none)
'--------
' Author : Van T. Dinh, Monday, 16 June 2003
'--------
' Revision History
' Monday, 16 June 2003 (VTD):
'================
On Error GoTo cmdSelect_Click_Err
Me.Visible = False
cmdSelect_Click_Exit:
Exit Sub
cmdSelect_Click_Err:
Select Case Err.Number
Case 0
Case Else
MsgBox "Error " & Err.Number & ": " &
Err.Description & vbCrLf & vbCrLf & _
"(Programmer's note:
Form_frmCalendar.cmdSelect_Click)" & vbCrLf, _
vbOKOnly + vbCritical, "Run-time Error!"
End Select
Resume cmdSelect_Click_Exit
End Sub
Private Sub Form_Current()
'================
' Form_frmCalendar.Form_Current
'--------
' Purpose:
'--------
' Notes :
'--------
' Parameters:
'
'--------
' Called Subs/Functions
' (none)
'--------
' Calling Subs/Functions
' (none)
'--------
' Returns:
' (none)
'--------
' Author : Van T. Dinh, Monday, 16 June 2003
'--------
' Revision History
' Monday, 16 June 2003 (VTD):
'================
On Error GoTo Form_Current_Err
Me.acxCalendar.Today
Form_Current_Exit:
Exit Sub
Form_Current_Err:
Select Case Err.Number
Case 0
Case Else
MsgBox "Error " & Err.Number & ": " &
Err.Description & vbCrLf & vbCrLf & _
"(Programmer's note:
Form_frmCalendar.Form_Current)" & vbCrLf, _
vbOKOnly + vbCritical, "Run-time Error!"
End Select
Resume Form_Current_Exit
End Sub
Private Sub Form_Open(Cancel As Integer)
'================
' Form_frmCalendar.Form_Open
'--------
' Purpose:
'--------
' Notes :
'--------
' Parameters:
' Cancel (Integer)
'--------
' Called Subs/Functions
' (none)
'--------
' Calling Subs/Functions
' (none)
'--------
' Returns:
' (none)
'--------
' Author : Van T. Dinh, Monday, 16 June 2003
'--------
' Revision History
' Monday, 16 June 2003 (VTD):
'================
On Error GoTo Form_Open_Err
DoCmd.Restore
If IsNull(Me.OpenArgs) = False Then Me.Caption =
Me.OpenArgs
'Me.acxCalendar.Today (does not work)
Form_Open_Exit:
Exit Sub
Form_Open_Err:
Select Case Err.Number
Case 0
Case Else
MsgBox "Error " & Err.Number & ": " &
Err.Description & vbCrLf & vbCrLf & _
"(Programmer's note: Form_frmCalendar.Form_Open)"
& vbCrLf, _
vbOKOnly + vbCritical, "Run-time Error!"
End Select
Resume Form_Open_Exit
End Sub
****
HTH
Van T. Dinh
MVP (Access)