G
gaugust
In Access 2003 (Windows XP) I am passing the value of a field in a textbox on
a form to a subroutine to validate that the date value is within a range. If
the date is out of range I would like to set the focus of the field on the
form and display an error message. When I pass in the field to the
subroutine, I get a compile error "Invalid qualifier" when I try to set focus
to the date field. How can I set the focus to the field within the
subroutine. Here is the subrotuine code:
Public Sub CheckDates(date1 As Date)
If Not IsNull(date1) And date1 < [Forms]![frmMRA]![frmSectionA -
1].Form![date_of_admission].Value Then
MsgBox "The date must be on or after the hospital admission date",
vbOKOnly, "Date out of range"
Cancel = True
date1.SetFocus
End If
End Sub
a form to a subroutine to validate that the date value is within a range. If
the date is out of range I would like to set the focus of the field on the
form and display an error message. When I pass in the field to the
subroutine, I get a compile error "Invalid qualifier" when I try to set focus
to the date field. How can I set the focus to the field within the
subroutine. Here is the subrotuine code:
Public Sub CheckDates(date1 As Date)
If Not IsNull(date1) And date1 < [Forms]![frmMRA]![frmSectionA -
1].Form![date_of_admission].Value Then
MsgBox "The date must be on or after the hospital admission date",
vbOKOnly, "Date out of range"
Cancel = True
date1.SetFocus
End If
End Sub