G
Guest
i have a main form with several sub forms located in it, built in access 2003
on my main form is a cmd button which makes sub form 1 visible and hides all
the other sub forms. sub form 1 is connected to a table.
on sub form 1 is a cmd button for inseting a new record. all works fine
im trying to get the cmd button on the main form to insert a new record once
the form is visible. my code for cmd button is:
Private Sub cmdMakeNewSupplierPayment_Click()
On Error GoTo Err_cmdMakeNewSupplierPayment_Click
' If EmployeeID combo is NULL, exit sub.
If IsNull(Combo12) Then Exit Sub
' Display Employee Details and hide all other forms.
Me.sbfrmSuppliersMainWindow.Visible = False
Me.sbfrmSuppliersPayments.Visible = True
Me.sbfrmSuppliersDetails.Visible = False
' Add new record
DoCmd.GoToRecord , "", acNewRec
Exit_cmdMakeNewSupplierPayment_Click:
Exit Sub
Err_cmdMakeNewSupplierPayment_Click:
Select Case Err.Number
Case Else
MsgBox "Error 061-005/" & Err.Number & "! " & Err.Description &
".", , CurrentDb.Properties("AppTitle")
Resume Exit_cmdMakeNewSupplierPayment_Click
End Select
End Sub
the DoCmd.GoToRecord , "", acNewRec line only referes to the main form and
im having difficulties finding the right code for it to add new record to sub
forms.
any help would be very much appreciated.
on my main form is a cmd button which makes sub form 1 visible and hides all
the other sub forms. sub form 1 is connected to a table.
on sub form 1 is a cmd button for inseting a new record. all works fine
im trying to get the cmd button on the main form to insert a new record once
the form is visible. my code for cmd button is:
Private Sub cmdMakeNewSupplierPayment_Click()
On Error GoTo Err_cmdMakeNewSupplierPayment_Click
' If EmployeeID combo is NULL, exit sub.
If IsNull(Combo12) Then Exit Sub
' Display Employee Details and hide all other forms.
Me.sbfrmSuppliersMainWindow.Visible = False
Me.sbfrmSuppliersPayments.Visible = True
Me.sbfrmSuppliersDetails.Visible = False
' Add new record
DoCmd.GoToRecord , "", acNewRec
Exit_cmdMakeNewSupplierPayment_Click:
Exit Sub
Err_cmdMakeNewSupplierPayment_Click:
Select Case Err.Number
Case Else
MsgBox "Error 061-005/" & Err.Number & "! " & Err.Description &
".", , CurrentDb.Properties("AppTitle")
Resume Exit_cmdMakeNewSupplierPayment_Click
End Select
End Sub
the DoCmd.GoToRecord , "", acNewRec line only referes to the main form and
im having difficulties finding the right code for it to add new record to sub
forms.
any help would be very much appreciated.