Forgive me if this isn't detailed enough but I have a Suppliers form (Suppliers) in MS Access 2000 with an unbound combo box (SupplierNameCbo) that allows the user to select a supplier name. When a selection is made, several text boxes on the form get filled in with the related table data using the control source method of "=SupplierNameCbo.Column(0), etc.." Thus, when a user selects a supplier in the combo box, then the SupplierID textbox on this form shows the corresponding supplier's number.
I also have a command button called Add Products on this form. I want to use the OnClick event of this button to open up another form called "Add Items" in Add mode only. However, I would like the SupplierID field on the Add Items form to have the supplier number filled in with the SupplierID number produced by the selection made from the Suppliers form. I tried the code below found on this forum and, unfortunately, it gives me the 'Object doesn't support this property or method' error message. Does anyone have some suggestions to fix this? Thanks!
Private Sub Add_Products_Click()
On Error GoTo Err_Add_Products_Click
Dim strDocName As String
strDocName = "Add Items"
'Open Add Items form in Add mode and store SupplierID in
'the form's OpenArgs property.
DoCmd.OpenForm strDocName, , , , acFormAdd, , Me!SupplierID
'Give SupplierPartNo control focus.
Forms![Add Items]!SupplierPartNo.SetFocus
Exit_Add_Products_Click:
Exit Sub
Err_Add_Products_Click:
MsgBox Err.Description
Resume Exit_Add_Products_Click
End Sub
I also have a command button called Add Products on this form. I want to use the OnClick event of this button to open up another form called "Add Items" in Add mode only. However, I would like the SupplierID field on the Add Items form to have the supplier number filled in with the SupplierID number produced by the selection made from the Suppliers form. I tried the code below found on this forum and, unfortunately, it gives me the 'Object doesn't support this property or method' error message. Does anyone have some suggestions to fix this? Thanks!
Private Sub Add_Products_Click()
On Error GoTo Err_Add_Products_Click
Dim strDocName As String
strDocName = "Add Items"
'Open Add Items form in Add mode and store SupplierID in
'the form's OpenArgs property.
DoCmd.OpenForm strDocName, , , , acFormAdd, , Me!SupplierID
'Give SupplierPartNo control focus.
Forms![Add Items]!SupplierPartNo.SetFocus
Exit_Add_Products_Click:
Exit Sub
Err_Add_Products_Click:
MsgBox Err.Description
Resume Exit_Add_Products_Click
End Sub