Navigation buttons

G

Guest

Hello!

On my subform I have my own navigation buttons (created using the command
button wizard). Currently, my subform is set so that the Access nagivation
buttons are still visible (the buttons that say "Record: 1 of 6 (Filtered)",
etc). The mainform is filtered so that it shows all the records in the
subform associated with the record on the mainform.

When I open the form, I can see from the Access navigation buttsons that I'm
looking at record 1 of 6 and if I wanted to scroll through the records, I can
using the other navigation buttons (they're enabled). If I click my own
navigation button (cmdNext) I get the message "You can't go to the specified
record". Only if I click the Access navigation button to scroll to, say the
second record, do my own navigation buttons work properly.

Why do I need to click the Access navigation buttons first before my own
navigation buttons work?

My code is nothing special...
"Private Sub cmdNext_Click()
On Error GoTo Err_cmdNext_Click


DoCmd.GoToRecord , , acNext

Exit_cmdNext_Click:
Exit Sub

Err_cmdNext_Click:
MsgBox Err.Description
Resume Exit_cmdNext_Click

End Sub"

Thanks in advance.
 
G

Guest

Mybe

Try and set the focus to the sub form before you move to the next record
Private Sub cmdNext_Click()
On Error GoTo Err_cmdNext_Click

Forms![MainFormName]![SubFormName].setfocus
DoCmd.GoToRecord , , acNext

Exit_cmdNext_Click:
Exit Sub

Err_cmdNext_Click:
MsgBox Err.Description
Resume Exit_cmdNext_Click

End Sub
 
G

Guest

Nope that didn't work. I even tried using a DoCmd.GoToControl on the subform
before going to the next record.

Any other suggestions? I'm having a REALLY bad day with navigation buttons.
On my other form when I hit my navigvation button a subform gets called and I
have NO idea why. I've checked my code over so many times!!!

Thanks

Ofer said:
Mybe

Try and set the focus to the sub form before you move to the next record
Private Sub cmdNext_Click()
On Error GoTo Err_cmdNext_Click

Forms![MainFormName]![SubFormName].setfocus
DoCmd.GoToRecord , , acNext

Exit_cmdNext_Click:
Exit Sub

Err_cmdNext_Click:
MsgBox Err.Description
Resume Exit_cmdNext_Click

End Sub
juicegully said:
Hello!

On my subform I have my own navigation buttons (created using the command
button wizard). Currently, my subform is set so that the Access nagivation
buttons are still visible (the buttons that say "Record: 1 of 6 (Filtered)",
etc). The mainform is filtered so that it shows all the records in the
subform associated with the record on the mainform.

When I open the form, I can see from the Access navigation buttsons that I'm
looking at record 1 of 6 and if I wanted to scroll through the records, I can
using the other navigation buttons (they're enabled). If I click my own
navigation button (cmdNext) I get the message "You can't go to the specified
record". Only if I click the Access navigation button to scroll to, say the
second record, do my own navigation buttons work properly.

Why do I need to click the Access navigation buttons first before my own
navigation buttons work?

My code is nothing special...
"Private Sub cmdNext_Click()
On Error GoTo Err_cmdNext_Click


DoCmd.GoToRecord , , acNext

Exit_cmdNext_Click:
Exit Sub

Err_cmdNext_Click:
MsgBox Err.Description
Resume Exit_cmdNext_Click

End Sub"

Thanks in advance.
 

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