access form in data sheet format

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 ?
 
M

Maurice

Mark,

The combo has to be unbound. So it does need a rowsource but it shouldn't
have a controlsource. See if that does the trick.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top