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!

addressing subform in VBA

Status
Not open for further replies.

netscamp

Technical User
Oct 3, 2003
19
0
0
US
I have a main form - I want to put a button on the main to jump ahead 10 records in a subform which is in datasheet view,

the main form is called "trans_table"

the sub is "main3"
I'm trying this code I got from the Access HELP files.
Code:
DoCmd.GoToRecord acForm, "trans_table.main3", acGoTo, 10

when click the button I get a message saying the object main3 isn't open -0h, but it is!

I can navigate through it using it's own built in buttons.

I've tried the second argument as acDataForm, and acForm.
I've tried Me.main3, also to no avail.

Any help is deeply appreciated.

thanks,
Robert
 
Hi

I need to know the name of teh sub form control, within which main3 is contained, I will assume it is also called Main3, if not you need to adjust the code below accordingly

I think the follow will do it

Dim i as Integer
For i = 1 to 10
Main3.FORM.recordsetClone.MoveNext
next i
Main3.FORM.bookmark = Main3.FORM.REcordsetClone.Bookmark

you will need error trapping for end of file !



Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top