Hi there
Really simple problem here - i'm trying to open a 'product entry' form with the same 'supplierID' as the current open form (which will be the supplier details form), ready to insert a new product (that is supplied by that supplier).
When i don't have the acFormAdd part, the form opens up with the correct supplierID, but opens at the first record (instead of being armed and ready for a new record - like i want).
When i add 'acFormAdd', the form opens with a new record in 'add' mode, however the supplierID is always 0.
What am i doing wrong?
The code is below...
Cheers!
Really simple problem here - i'm trying to open a 'product entry' form with the same 'supplierID' as the current open form (which will be the supplier details form), ready to insert a new product (that is supplied by that supplier).
When i don't have the acFormAdd part, the form opens up with the correct supplierID, but opens at the first record (instead of being armed and ready for a new record - like i want).
When i add 'acFormAdd', the form opens with a new record in 'add' mode, however the supplierID is always 0.
What am i doing wrong?
The code is below...
Code:
Private Sub addButton_Click()
On Error GoTo Err_addButton_Click
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.RunCommand acCmdSaveRecord
stLinkCriteria = "[SupplierID]=" & Me![SupplierID]
stDocName = "frmProducts"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Exit_addButton_Click:
Exit Sub
Err_addButton_Click:
MsgBox Err.description
Resume Exit_addButton_Click
End Sub
Cheers!