Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I change the record on a sub form

Status
Not open for further replies.

tinkiewinkie

Programmer
Nov 4, 2002
5
0
0
GB
I am trying to change the current record in a sub-form using VBA code in access. I am using the DoCmd.GoToRecord method, but I don't seem to get the object right. Here is the line of code:

DoCmd.GoToRecord acDataForm, Forms("frmFind")("subFrmFind").Form, acGoTo, 12

Where subFrmFind is the subform and frmFind is the main form. I want it to go to record twelve in this example.

Whenever I trigger this code it responds with an error:

The expression you entered is the wrong data type for one of the arguments.

Thanks in advance.
 
Yea, I tried that one, but still no luck. I get the error:

Run-time error 2498

An expression you entered is the wrong data type for one of the arguments.


???? It works if it is not a sub form without the form bit at the end - Stuck!

Thanks
 
tinkiewinkie,

Try Docmd.GotoRecord, acForm, "subFrmFind", acGoto, 12

According to reference, the name of the form should be a string and must be any 'open form'.

No need for naming conventions as the 'acForm' indicates the proper object.

See what you see.

Rick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top