wabtrainer
IS-IT--Management
I have a text box for a Date on a form.
When the field has focus an activeX calendar becomes visible to allow the date to be selected, but when I enter the textbox i get a message "Runtime error 94 invalid use of Null.
The relevant pieces of code are:
Private Sub ActiveXCtl18_AfterUpdate()
Me!Date = ActiveXCtl18.Value
Me!Date.SetFocus
' Close the calendar after picking a new valid date
Me!ActiveXCtl18.Visible = False
End Sub
Private Sub Date_BeforeUpdate(Cancel As Integer)
If Not Me!ActiveXCtl18.Object.Value Then
Cancel = True
End If
End Sub
Private Sub Date_GotFocus()
Me!ActiveXCtl18.Visible = True
If IsNull(Me!Date) Then
' Set date to today as a default
Me!ActiveXCtl18.Year = Year(Date)
Me!ActiveXCtl18.Month = Month(Date)
Me!ActiveXCtl18.Value = Date
End If
End Sub
Anyone know what I am doing wrong????
When the field has focus an activeX calendar becomes visible to allow the date to be selected, but when I enter the textbox i get a message "Runtime error 94 invalid use of Null.
The relevant pieces of code are:
Private Sub ActiveXCtl18_AfterUpdate()
Me!Date = ActiveXCtl18.Value
Me!Date.SetFocus
' Close the calendar after picking a new valid date
Me!ActiveXCtl18.Visible = False
End Sub
Private Sub Date_BeforeUpdate(Cancel As Integer)
If Not Me!ActiveXCtl18.Object.Value Then
Cancel = True
End If
End Sub
Private Sub Date_GotFocus()
Me!ActiveXCtl18.Visible = True
If IsNull(Me!Date) Then
' Set date to today as a default
Me!ActiveXCtl18.Year = Year(Date)
Me!ActiveXCtl18.Month = Month(Date)
Me!ActiveXCtl18.Value = Date
End If
End Sub
Anyone know what I am doing wrong????