D
DubboPete
Hi all,
I have instances where my checking routines happily move the focus from one
field to another.
But for some particular reason, I can't get this one to work...
A form which is used to select reports (between selected 'Startdate' and
'EndDate') works fine when there are two dates, one in each box. Clicking
command buttons to open reports work fine - when both dates are present and
are (correctly) chronologically distanced.
I want to be able to prompt the user to fill out the missing date field if
they 'jump the gun' and forget to, say, put the 'EndDate' in...
Here's what I have in the code to check dates, which works fine.
When user clicks a command button to preview a report, and one or both dates
are missing, then:
If IsNull(Me![StartDate]) Or IsNull(Me![EndDate]) Then
msgBox "One or more dates is missing." & vbCrLf & "Please fix and
try again.", vbInformation
GoTo Exit_Sub_btn1990_click
End If
What I am trying to do, is get the focus back on to the control which is
causing the error. So I thought by inserting a little code on the
'StartDate' and 'EndDate' fields, it would set the focus on the erroneous
field. Point to note, I don't want it looping continuously between two
fields, so this is where the help is needed.
On the 'GotFocus' event of the 'StartDate' field, i inserted this code, then
tested it by entering only the 'StartDate'
If Not IsNull(Me![StartDate]) Then
Me!EndDate.SetFocus
End If
but nothing happened, and the focus sits on the command button clicked,
which incidentally has 'tab stop' set to 'no', as does everything but the
'StartDate' and EndDate' fields. It won't go to the 'EndDate' field which
is blank.
But, I get this popup error box with following contents:
xxx can't move the focus to the control 'StartDate'
* the control may be of a type that can't receive the focus, such as a label
'Not True, It's a control called [StartDate]
* The control's Visible property may be set to No 'not true, Visible = Yes
* The control's Enabled property may be set to no 'Not true, Enabled = Yes
I also tried
DoCmd.GoToControl "EndDate"
instead of Me!EndDate.SetFocus, but that didn't work either...
any ideas anyone?
thanks in anticipation
DubboPete
I have instances where my checking routines happily move the focus from one
field to another.
But for some particular reason, I can't get this one to work...
A form which is used to select reports (between selected 'Startdate' and
'EndDate') works fine when there are two dates, one in each box. Clicking
command buttons to open reports work fine - when both dates are present and
are (correctly) chronologically distanced.
I want to be able to prompt the user to fill out the missing date field if
they 'jump the gun' and forget to, say, put the 'EndDate' in...
Here's what I have in the code to check dates, which works fine.
When user clicks a command button to preview a report, and one or both dates
are missing, then:
If IsNull(Me![StartDate]) Or IsNull(Me![EndDate]) Then
msgBox "One or more dates is missing." & vbCrLf & "Please fix and
try again.", vbInformation
GoTo Exit_Sub_btn1990_click
End If
What I am trying to do, is get the focus back on to the control which is
causing the error. So I thought by inserting a little code on the
'StartDate' and 'EndDate' fields, it would set the focus on the erroneous
field. Point to note, I don't want it looping continuously between two
fields, so this is where the help is needed.
On the 'GotFocus' event of the 'StartDate' field, i inserted this code, then
tested it by entering only the 'StartDate'
If Not IsNull(Me![StartDate]) Then
Me!EndDate.SetFocus
End If
but nothing happened, and the focus sits on the command button clicked,
which incidentally has 'tab stop' set to 'no', as does everything but the
'StartDate' and EndDate' fields. It won't go to the 'EndDate' field which
is blank.
But, I get this popup error box with following contents:
xxx can't move the focus to the control 'StartDate'
* the control may be of a type that can't receive the focus, such as a label
'Not True, It's a control called [StartDate]
* The control's Visible property may be set to No 'not true, Visible = Yes
* The control's Enabled property may be set to no 'Not true, Enabled = Yes
I also tried
DoCmd.GoToControl "EndDate"
instead of Me!EndDate.SetFocus, but that didn't work either...
any ideas anyone?
thanks in anticipation
DubboPete