D
David_Beginner
Creating New record in subform
Let me start by setting up the scenario as simply as I can. I believe it's
fairly typical...
4 tables:
tblclients [clientid][clientname][active]
tblorders [clientid][orderid]
tblorderdetails [orderid][productid]
tblProducts [productID]
3 Forms, embedded:
Forms Masterorder, Suborder1, suborder2
Form Masterorder has a one UNBOUND combo box which queries tblclients.
clientid,name,active.
The after update has the corresponding code
Private sub
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ClientID] = " & Str(Nz(Me![Combo45], 0))
Me.Bookmark = rs.Bookmark
If Not rs.EOF Then
End Sub
Form Suborder1 queries tblOrders.clientid, orderid
Linkage between masterorder and ordersub1 is on clients.ClientID and Orders.
CientID
Form Suborder2 queries tblorderdetails.orderid and tblproducts.productid
Linkage between ordersub1 and ordersub2 is on tblorders.orderid and
tblorderdetails.orderid
Note, Before I created this form I had already entered orders for many
customers in a form, but the combo box could only select clients for new
orders, not lookup existing orders.
In this new form the combobox effectively looks up the order for every
customer that is selected in the combo box list.
However, if a customer is selected from the combo box and has no order, then
the subform is blank. Products can be addedin subform 2, but no order Id
will be established in either the orders or ordersdetail tables.
When I click new in the navigation bar and select a customer from the combo
box which has no order then still no new order id is established in the
orders table.
How can I create a new order for a new customer in this form, or can I?
If someone could point me in the right direction, I would really appreciate
it.
Thank you,
david
Let me start by setting up the scenario as simply as I can. I believe it's
fairly typical...
4 tables:
tblclients [clientid][clientname][active]
tblorders [clientid][orderid]
tblorderdetails [orderid][productid]
tblProducts [productID]
3 Forms, embedded:
Forms Masterorder, Suborder1, suborder2
Form Masterorder has a one UNBOUND combo box which queries tblclients.
clientid,name,active.
The after update has the corresponding code
Private sub
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ClientID] = " & Str(Nz(Me![Combo45], 0))
Me.Bookmark = rs.Bookmark
If Not rs.EOF Then
End Sub
Form Suborder1 queries tblOrders.clientid, orderid
Linkage between masterorder and ordersub1 is on clients.ClientID and Orders.
CientID
Form Suborder2 queries tblorderdetails.orderid and tblproducts.productid
Linkage between ordersub1 and ordersub2 is on tblorders.orderid and
tblorderdetails.orderid
Note, Before I created this form I had already entered orders for many
customers in a form, but the combo box could only select clients for new
orders, not lookup existing orders.
In this new form the combobox effectively looks up the order for every
customer that is selected in the combo box list.
However, if a customer is selected from the combo box and has no order, then
the subform is blank. Products can be addedin subform 2, but no order Id
will be established in either the orders or ordersdetail tables.
When I click new in the navigation bar and select a customer from the combo
box which has no order then still no new order id is established in the
orders table.
How can I create a new order for a new customer in this form, or can I?
If someone could point me in the right direction, I would really appreciate
it.
Thank you,
david