"Mary/Phil Stewart" <(E-Mail Removed)> wrote in message
news:5abWb.141990$U%5.647004@attbi_s03
> I have a form with a command button. Which when clicked goes to the
> next record. However, when it gets to a given record I want the
> cursor to go a field other than the first one. The field I want to be
> focused on is, "Page". Here is the code I am using:
>
> Private Sub NextATM_Click()
> On Error GoTo Err_NextATM_Click
>
>
> DoCmd.GoToRecord , , acNext
> Page.SetFocus
>
> Exit_NextATM_Click:
> Exit Sub
>
> Err_NextATM_Click:
> MsgBox Err.Description
> Resume Exit_NextATM_Click
>
> End Sub
>
> When I click on the command button, with this code in place, I get an
> error, "Compile Error: Invalid qualifier"
> I am using Access2K with Win2K.
>
> Can anybody help?
> Thanks,
> Phil
It seems likely that the problem is with the name "Page", which is a
reserved word and a property of the Form object. It's not a good idea
to use reserved words for your own objects and variables, as Access is
liable to misunderstand you. Either change the name of the control to
something else (e.g., "txtPage", if it's a text box), or use a more
explicit sytax to refer to it:
Me!Page.SetFocus
or even
Me.Controls("Page").SetFocus
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)