Move to next record in subform (1 Viewer)

Marko Stojovic

Registered User.
Local time
Today, 09:27
Joined
Jan 25, 2001
Messages
29
I hope someone can help me with this:

How do you move programatically to the next record in a subform?

I tried Forms("mainform").controls("child1").form.controls("text1").SetFocus [which works!] followed by DoCmd.GoToRecord acDataForm, [...]("child1").form, acnext [which doesn't].

Go on, tell me how!

Thanks.
Marko.

[This message has been edited by Marko Stojovic (edited 03-20-2001).]
 

llkhoutx

Registered User.
Local time
Today, 03:27
Joined
Feb 26, 2001
Messages
4,018
Use the Button icon on the Tools toolbar and the wizard with appears to add a button to your subform to move to the next record. Remember, there has to be a next record, otherwise you get an error.

Alternatively, veiw the properies for the subform and set the NavigationButtons property for the subform to YES.
 

Marko Stojovic

Registered User.
Local time
Today, 09:27
Joined
Jan 25, 2001
Messages
29
Thanks for the advice. I've actually already got such buttons installed. The problem is, I need to move to the next record programatically, and I can't seem to find a command that would carry anything like this out on a subform while it is open in the context of the main form. I just get the message 'form not open'. Opening it in its own right would defeat the objective, because I need to go from record to record while the parent form is open...

Marko
 

kaspi

Registered User.
Local time
Today, 09:27
Joined
Nov 22, 2000
Messages
60
Hi Marko
I would use the subform recordset to move around in the subform.
If you put a button on your form and put code like this
Private Sub cmd_Move_inSub_Click()
Dim rs As DAO.Recordset

Set rs = Me.Controls("Subform").Form.Recordset
'establish a position of the pointer (use find etc)
'you can use recordset clone to move in the recordset without showing it on the form
'you can use bookmarks to show the position in the recordset clone in the form recordset
rs.MoveNext
Set rs = Nothing

End Sub

in the click event you should get the effect that you are after.
(I am using A2K)

Regards
Jiri
 

Marko Stojovic

Registered User.
Local time
Today, 09:27
Joined
Jan 25, 2001
Messages
29
Thank you for your advice. Sounds good, I'll give it a try.

P.S. Tried it - I think Access 97 hasn't got a Form.Recordset option, but it worked via RecordsetClone bookmark synchronisation (sounds very advanced). Ta.

Marko.

[This message has been edited by Marko Stojovic (edited 03-22-2001).]
 

Users who are viewing this thread

Top Bottom