N
na
I will admit I am VBA challanged so I copied code from an example to have a
command button call up the activex calendar in Access and and populate a text
field. The example however, assumed I only had one field that needed a date.
On my form I have a total of 3 fields that need dates. I have created
command buttons for all three and with the code below I am all set for the
first box but not the other two. The samples I've seen on the web don't
address this and I want to avoid using a combo box to call up the calander.
Here is the code I have:
Option Compare Database
Option Explicit
Private Sub calCtl1_Click()
Me.Text2 = Me.calCtl1.Value
Me.Text2.SetFocus
Me.calCtl1.Visible = False
End Sub
Private Sub cmdCal_Click()
On Error GoTo Err_cmdCal_Click
Me.calCtl1.Visible = True
If Not IsNull(Me.Text2) Then
Me.calCtl1.Value = Me.Text2
Else
Me.calCtl1.Value = Date
End If
Exit_cmdCal_Click:
Exit Sub
Err_cmdCal_Click:
MsgBox Err.Description
Resume Exit_cmdCal_Click
End Sub
I truly have looked for a solution and am at my wit's end - as I said VBA is
not my strong suit. Can someone point me in the right direction?
Thanks
command button call up the activex calendar in Access and and populate a text
field. The example however, assumed I only had one field that needed a date.
On my form I have a total of 3 fields that need dates. I have created
command buttons for all three and with the code below I am all set for the
first box but not the other two. The samples I've seen on the web don't
address this and I want to avoid using a combo box to call up the calander.
Here is the code I have:
Option Compare Database
Option Explicit
Private Sub calCtl1_Click()
Me.Text2 = Me.calCtl1.Value
Me.Text2.SetFocus
Me.calCtl1.Visible = False
End Sub
Private Sub cmdCal_Click()
On Error GoTo Err_cmdCal_Click
Me.calCtl1.Visible = True
If Not IsNull(Me.Text2) Then
Me.calCtl1.Value = Me.Text2
Else
Me.calCtl1.Value = Date
End If
Exit_cmdCal_Click:
Exit Sub
Err_cmdCal_Click:
MsgBox Err.Description
Resume Exit_cmdCal_Click
End Sub
I truly have looked for a solution and am at my wit's end - as I said VBA is
not my strong suit. Can someone point me in the right direction?
Thanks