Combo Box Row Source Query

G

Guest

So I have a Form with 2 subforms
The main form is the shift record
The 1st subform is the on duty staff (filled out for each shift)
The 2nd subform is a list of events

On the 2nd subform I have a combo box that has a row source of a query of
the source table of the first form. That query is filtered by the ShiftID of
the active shift record. When it runs it just returns a list of people
inputted for the current main form shift that is open.

The problem is that the query isn't being refreshed after the initial
opening of the main form. I had assumed that by basing it on a query, it
would run the query each time. But it isn't.

Any advice to make the combo box row source query update either each time
that a record in the subform is open or whenever the combo box is clicked?
 
C

Carl Rapson

Bill Davis said:
So I have a Form with 2 subforms
The main form is the shift record
The 1st subform is the on duty staff (filled out for each shift)
The 2nd subform is a list of events

On the 2nd subform I have a combo box that has a row source of a query of
the source table of the first form. That query is filtered by the ShiftID
of
the active shift record. When it runs it just returns a list of people
inputted for the current main form shift that is open.

The problem is that the query isn't being refreshed after the initial
opening of the main form. I had assumed that by basing it on a query, it
would run the query each time. But it isn't.

Any advice to make the combo box row source query update either each time
that a record in the subform is open or whenever the combo box is clicked?

Combo boxes won't automatically requery their row sources. You can do that
explicitly with the Requery method of the combo box. Call this method
anywhere you want the combo box to be requeried - in the subform's Current
event, for example, or in the Click event of another combo box.

Carl Rapson
 
G

Guest

Thanks. I experienced a "but I did this with my hand moment". What you said
below is what I had been trying and it just wasn't working. I read your
suggestion, started over and got it to work. I am guessing that something I
did in one permutation was messing up what should have worked...
 

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