Hi,
I have a an invoicing database that has a main/sub form setup. Each subform row has a unique RowID and an InvoiceID - the InvoiceID is the field that connects the sub to the main.
I want to add a "Next" button that advances the main form InvoiceID without going through all the rows in the subform that are attached to it.
eg.
InvoiceID 10010 has 3 RowIDs
InvoiceID 10011 has 2 RowIDs
InvoiceID 10012 has 5 RowIDs
The next button should take one press to advance between the InvoiceIDs.
This works perfectly when using the default record selectors at the bottom of the main form, but when I try to add a VBA button it takes 3 presses to get through InvoiceID 10010, 2 presses for InvoiceID 10011 etc....
I've also tried to incorporate a check to ensure that no new records are created :
Why isn't this working as I would like ?
Apologies in advance for any n00bness on my part
I have a an invoicing database that has a main/sub form setup. Each subform row has a unique RowID and an InvoiceID - the InvoiceID is the field that connects the sub to the main.
I want to add a "Next" button that advances the main form InvoiceID without going through all the rows in the subform that are attached to it.
eg.
InvoiceID 10010 has 3 RowIDs
InvoiceID 10011 has 2 RowIDs
InvoiceID 10012 has 5 RowIDs
The next button should take one press to advance between the InvoiceIDs.
This works perfectly when using the default record selectors at the bottom of the main form, but when I try to add a VBA button it takes 3 presses to get through InvoiceID 10010, 2 presses for InvoiceID 10011 etc....
I've also tried to incorporate a check to ensure that no new records are created :
Code:
Private Sub btn_NextButton_Click()
'------------------------------------------------------------
' CONTROL FOR NEXT BUTTON
'------------------------------------------------------------
On Error GoTo btn_NextButton_Click_Err
Dim test As Long
On Error Resume Next
'Don't go beyond the maximum records
If Me.CurrentRecord < Me.Recordset.RecordCount Then
DoCmd.GoToRecord acDataForm, "frm_MainInput", acNext
Else
Beep
MsgBox "Last Record Displayed", vbOKOnly, ""
End If
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
btn_NextButton_Click_Exit:
Exit Sub
btn_NextButton_Click_Err:
MsgBox Error$
Resume btn_NextButton_Click_Exit
Why isn't this working as I would like ?
Apologies in advance for any n00bness on my part