Scroll through parent records instead of sub form records.

R

Richard Horne

I've got an annoying problem that I'm sure is a simple tick box away from
being solved but it's causing no end of hair pulling at the moment.

I have a form which contains a sub form, but for some reason the record
navigation buttons at the bottom apply to the individual records on the sub
form and not the parent record in the master form. So for example say I have
one master record with 5 records in the sub form, the record navigation
allows me to click forward 5 times for each record in the sub form, when in
actual fact I want just one click to move to the next parent record.

Which really obvious option am I missing? :S
 
B

BruceM

Make sure that the navigation button property for the main form is set to
Yes. If the subform is continuous, you probably want to set the same
property to No for the subform. Also, try maximizing the main form, in case
the navigation buttons are hiding behind the Windows task bar.
 
W

Wayne-I-M

Hi Richard

Bruces answer is correct but if you wanted to add a button (or 2) to the
main form you could use something like this (the error message is to stop
users getting confused - you can remove it if you want)

Private Sub Button_Click()
On Error GoTo Err_Button_Click
DoCmd.GoToRecord , , acNext
Exit_Button_Click:
Exit Sub
Err_Button_Click:
MsgBox "This is the last record", vbOKOnly, "Stop pressing the button"
Resume Exit_Button_Click
End Sub


Of course you could place 2 buttons (one forward and one for back) the
second button would use
DoCmd.GoToRecord , , acPrevious

Hope this helps
 

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

Top