M
mark_matchett
I am trying to view the results of a query in a form.
I have a "sales order table" that has order lines, each line has product
detail and a "CustomerID" which comes from a table called "Contacts"
I have queried the relevant data from the sales order table and created a
form in datasheet format.
I want to be able to select the customers ID from a combo box and for the
datasheet view form to then update showing only the order lines applicable to
that customer. The Combo box is currently set to select data from the
contacts table, the data comes from the Sales order table. ( 1 to many)
So far I have taken the CustomerID field from the form and written the
following code to try and make it work, but it dosnt update the data in the
form.
Private Sub combo_coname_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CompanyName] = '" & Me![combo coname] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Whats is the best way to achieve this ?
I have a "sales order table" that has order lines, each line has product
detail and a "CustomerID" which comes from a table called "Contacts"
I have queried the relevant data from the sales order table and created a
form in datasheet format.
I want to be able to select the customers ID from a combo box and for the
datasheet view form to then update showing only the order lines applicable to
that customer. The Combo box is currently set to select data from the
contacts table, the data comes from the Sales order table. ( 1 to many)
So far I have taken the CustomerID field from the form and written the
following code to try and make it work, but it dosnt update the data in the
form.
Private Sub combo_coname_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[CompanyName] = '" & Me![combo coname] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Whats is the best way to achieve this ?