Can't reference form

R

Robby

Hi,

I am trying to go to the first record in a subform. I am using the following
command:

DoCmd.GoToRecord acDataForm, [Forms]![lkrbfrm_Orders]![sfrm_OrdMDetails],
acFirst

However I am getting an error:

"Error 2498
An expression you entered is the wrong data type for one of the arguments"

I presume its trying to tell me it wants a string in the 2nd argument of my
command and I am giving it a form.

How do I get aroung this problem

Robert
 
S

Steve Schapel

Robby,

If your code is activated from an event on the subform itself, I think
it should work with no specification, i.e. ...
DoCmd.GoToRecord , , acFirst

If your code is activated from elsewhere, you will need to use either
GoToControl or SetFocus to get yourself onto the subform first.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top