I am trying to create a button on a sub form to add the records on it to another sub form on the same for, if that makes any sense!
below is my current code and it works sort of, it picks the the records and values but doesn't put it onto the other form.
any ideas?
Private Sub AddOrderbtn_Click()
On Error GoTo Err_AddOrderbtn_Click
DoCmd.SetWarnings False '..cancel system warnings
MsgBox "INSERT INTO T_Order_line(ProductID, Description, Price, Stock Level)" _
& " VALUES " & [ProductID] & ", " & [Description] & ", £" & [Price] & ", Level: " & [Stock Level] & ""
Forms![F_Orders].[Product Catalogue].Requery
Exit_AddOrderbtn_Click:
Exit Sub
Err_AddOrderbtn_Click:
MsgBox Err.Description
Resume Exit_AddOrderbtn_Click
End Sub
Private Sub ProductCombo_AfterUpdate()
If ProductCombo.Value <> "" Then
ProductID.SetFocus '..set the focus to the field returned by the combo box
DoCmd.FindRecord ProductCombo.Value, acAnywhere, False, acSearchAll, False, acCurrent, True
End If
End Sub
below is my current code and it works sort of, it picks the the records and values but doesn't put it onto the other form.
any ideas?
Private Sub AddOrderbtn_Click()
On Error GoTo Err_AddOrderbtn_Click
DoCmd.SetWarnings False '..cancel system warnings
MsgBox "INSERT INTO T_Order_line(ProductID, Description, Price, Stock Level)" _
& " VALUES " & [ProductID] & ", " & [Description] & ", £" & [Price] & ", Level: " & [Stock Level] & ""
Forms![F_Orders].[Product Catalogue].Requery
Exit_AddOrderbtn_Click:
Exit Sub
Err_AddOrderbtn_Click:
MsgBox Err.Description
Resume Exit_AddOrderbtn_Click
End Sub
Private Sub ProductCombo_AfterUpdate()
If ProductCombo.Value <> "" Then
ProductID.SetFocus '..set the focus to the field returned by the combo box
DoCmd.FindRecord ProductCombo.Value, acAnywhere, False, acSearchAll, False, acCurrent, True
End If
End Sub