Hi Jon,
You just need to run the appropriate append query to append (add) the
product id and color id for the customer involved.
You can use the optional OpenArgs argument to pass the OrderID value to your
popup form. Alternatively, you can create an expression that grabs the
OrderID value from the named form. For example:
Code in Popup form:
OrderID = Forms!FormName!NameOfSubformControl!Form!NameOfControl
where FormName is the name of your customers form, NameOfSubformControl is
the name of the control that holds the Orders subform (which may be different
from the actual name of the form) and NameOfControl is the name of the
control that has the OrderID value.
The click event of a command button can be used to initiate the append
query. Something like this:
Option Compare Database
Option Explicit
Private Sub cmdAddProduct_Click()
On Error GoTo ProcError
Dim strSQL As String
strSQL = "INSERT INTO [OrderDetails] ([OrderID], [ProductID], [ColorID]) " _
& "VALUES (" & OrderID & ", " & ProductID & ", " & ColorID & ")"
Debug.Print strSQL '<---Use for debugging purposes only. Allows one to copy
' the resulting SQL statement to a new
query for testing.
CurrentDb.Execute strSQL, dbFailOnError
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure cmdAddProduct_Click..."
Resume ExitProc
End Sub
Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________