Connect Combo Box to Subform

C

Commish

I've been working on this for a few hours. Looking. Seaching for a
tutorial because I want to learn this for myself.

What is the secret handshake required to create a combo box that -
when a value is selected - will create a subset of records related to
the selected value in the combo box, and display them in a subform?
 
G

ghetto_banjo

Have your subform be based on a query. This query will need to use
the combobox value as criteria to get your related records (make sure
bound column of combobox is correct). On the After Update event of
the combobox, you can do me.subformname.requery to refresh it.
 
C

Commish

Have your subform be based on a query.  This query will need to use
the combobox value as criteria to get your related records  (make sure
bound column of combobox is correct).  On the After Update event of
the combobox, you can do me.subformname.requery to refresh it.

Ugh. I'm really confused about why I cannot seem to get something
working that seems so basic.

I'm going to try and put some detail here and try to fully explain
what I am trying to do and hope that someone can identify my blind
spot.

It's baseball season, and I am taking Sean Lahman's database
(available at www.baseball1.com) and trying to make an application
that I can use at a fantasy baseball draft. There's lots of commercial
software out there, I figured that I should take a crack at making one
for my use. I figured that I'd learn a lot while doing it.

It's a fairly well normalized database. So, I start by using a query
(qry_batters) to join the MAIN table and BATTING table while applying
a filter so that I only see that stats from players that had more than
0 At Bats in 2008. Otherwise, I'll get everyone who ever played. I
also use do sum grouping to get 1 stat line for players that played on
more than 1 team in 2008. That query appears to work fine. The field
PlayerID is in column 1.

Now, the form and subform is where I am getting lost. I create a form
called sfrm_batters using qry_batters as the source for the data.

Then I create a second blank form, and insert a ComboBox. And from the
wizard, I choose the qry_batters as the source of values for the
ComboBox. The field PlayerID is the first of 3 fields in the ComboBox
along with LastName and FirstName. Then I insert a subform, using the
sfrm_Batters that I previously created. The ComboBox is bound to
column 1.

So, when I save this and the form shows the combobox, which allows me
to select players, what do I need to do now to get the sfrm_batters to
respond and jump to the correct record - and preferably, filter out
the other records?
 

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