Hello
I have a form in Access 97 and one of the events I have handled is the form_current event (when the current record changes)
One thing I did was to check the value of some bound text boxes to do some stuff, and for this I had to set the focus to each text box before I could check its value (or so Access said, anyway)
I had intended to reset the focus back to what it was before I did this using this procedure.
Private Sub Form_Current()
Dim ctl As Control
set ctl = Me.ActiveControl
...
'do stuff which means moving the focus
...
'reset the focus
ctl.SetFocus
End Sub
The problem I have is that Access complains that
"Run Time Error 2474
The expression you entered requires the control to be in the active window"
on the line "set ctl = me.ActiveControl"
Why is it having a problem with this. I could understand this happening when the form is opened, and I can just ignore the error with on error resume next, but it happens every time I move the current record.
Any ideas?
Thanks
Mark Mark![[openup] [openup] [openup]](/data/assets/smilies/openup.gif)
I have a form in Access 97 and one of the events I have handled is the form_current event (when the current record changes)
One thing I did was to check the value of some bound text boxes to do some stuff, and for this I had to set the focus to each text box before I could check its value (or so Access said, anyway)
I had intended to reset the focus back to what it was before I did this using this procedure.
Private Sub Form_Current()
Dim ctl As Control
set ctl = Me.ActiveControl
...
'do stuff which means moving the focus
...
'reset the focus
ctl.SetFocus
End Sub
The problem I have is that Access complains that
"Run Time Error 2474
The expression you entered requires the control to be in the active window"
on the line "set ctl = me.ActiveControl"
Why is it having a problem with this. I could understand this happening when the form is opened, and I can just ignore the error with on error resume next, but it happens every time I move the current record.
Any ideas?
Thanks
Mark Mark
![[openup] [openup] [openup]](/data/assets/smilies/openup.gif)