By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,283 Members | 1,709 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,283 IT Pros & Developers. It's quick & easy.

Combo Box Query On One-To-Many Form.

P: n/a
Me
Hi,

In my application, I have two records, customers and transactions.Each
customer may have many transactions and so I have created a one to many
relationship between them.

I have a form based on customers and on it, a subform based on transactions.

This works fine, as I move through the customers, I can see the transactions
relating to a specific customer.

I now want to place a combo box on my transactions form that will allow me
to move to a specific transaction for the current customer, however when I
did this, the combo box was populed with details of all transactions for all
customers.

How do I limit the combo box to display transactions for only the current
customer ?

I guess that I'll also need to re-populate the combo box every time I change
customer. How do I do this ?

Many Thanks.

Mark.
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Your combo shouldn't be bound, if it is. You'll need to set your combs
..Rowsource to something like this:

SELECT lngTransactionID, strTransactionNumber FROM tblTransactions WHERE
lngCustomerID=" & Me.Parent.Form!lngCustomerID

You'll need to set the properly Columns number and widths ...

In the AFterUpdate event of your combo, do something like this:

Dim rst As DAO.Recordset
Set rst = Me.Recordsetclone

rst.findfirst = "lngTransactionID=" & Me.NameOfYourCombo.Column(0)

If not rst.nomatch then
me.bookmark = rst.bookmark
end if

rst.close
set rst = nothing

You will of course have to change the table/field/control names to match
those in your project.
--
Scott McDaniel
CS Computer Software
Visual Basic - Access - Sql Server - ASP

"Smash forehead on keyboard to continue ... "
"Me" <no************@virgin.net> wrote in message
news:uh********************@newsfep2-win.server.ntli.net...
Hi,

In my application, I have two records, customers and transactions.Each
customer may have many transactions and so I have created a one to many
relationship between them.

I have a form based on customers and on it, a subform based on transactions.
This works fine, as I move through the customers, I can see the transactions relating to a specific customer.

I now want to place a combo box on my transactions form that will allow me
to move to a specific transaction for the current customer, however when I
did this, the combo box was populed with details of all transactions for all customers.

How do I limit the combo box to display transactions for only the current
customer ?

I guess that I'll also need to re-populate the combo box every time I change customer. How do I do this ?

Many Thanks.

Mark.

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.