Rowsource combo box reseting

G

Guest

have 4 combo boxes whos row source is dependant on the first 2.EG

CBOA drives the rowsource for CBO B and CBOD

CBO B drive the Row source for CBOC

CBOA is on the main form CBO B<C<D or on a subform

The row source is set on After update events on the CBO Boxes

All data returened is fine.

BUT

When i look up old information the rowsource seems to be stuck on the last
entry i loooked at. So data looks like it is missing in bits and parts part
of my contious form.

Helppp
 
S

Sandra Daigle

Call the same code in the Current Event of the form - this event fires after
record navigation so it's the place to do requeries and this type of thing.
FWIW, if the code is more than one or two lines I would probably put it in a
separate procedure and call that procedure from both the AfterUpdate event
and from the Current event rather than duplicating the entire set of code in
two places (which leads to maintenance nightmares).
 
G

Guest

Data

Peter <--- Selected CBOA

Peter is booked to jobs uk1,uk2,uk3<------Populated CBO A on the choice that
Peters PersId is booked aginst these JobId numbers

User selects UK1

Jobnumbers UK1-1,UK1-2,UK1-3 are populated into CBOC as these 3 jumbers
where assigned to the Job

User Selects UK1-2.

Because Peter was selected CBOD has looked up the differnet hourly rates
peter cost the choice is standard time or overtime. CBO D is populatd with
Standard time

User fills out rest of data to look like this


Peter <-----CBOA WEEK (TXTbOX) YEAR(TXTBOC)

Job(CBOB) Jobnumber(CBOC) Cost(CBOD)
UK1 UK1-2 STANDARD TIME
UK2 UK2-1 OVERTIME
UK1 UK1-1 OVERTIME
UK3 UK3-2 STANDARD TIME

tHIS DATA SAVE AWAY FINE AND CAN BE SEEN IN THE TABLE

hAVE A FILTER ON THE MAIN FORM I CAN SELECT NAME YEAR AND WEEK to recall the
data this filter is on the main form.

i recall the data

Peter <-----CBOA WEEK (TXTbOX) YEAR(TXTBOC)

Job(CBOB) Jobnumber(CBOC) Cost(CBOD)
UK1 UK1-2 STANDARD TIME
UK2 OVERTIME
UK1 UK1-1 OVERTIME
UK3 STANDARD TIME

Result set looks like this

Look in table the data is still there

I set the rw source on After update events like so

cboCtrID.RowSource = _
"SELECT tblCTR.CTRID,tblCTR.CTRNo,tblJob.JobID FROM tblJob LEFT JOIN tblCTR
ON tblJob.JobID = tblCTR.JobID WHERE(tblCTR.JobID) = " & _
Me.cboJobID

CboCTRID = CBOC and tblCTR.JobID = CBOD


I am trying to give u as much infor as possible here thank you for helping
 
S

Sandra Daigle

Ok, I misunderstood the problem . You do need to do the same recordsource
reassignement in the current event as you would do in the AfterUpdate event
of CBOB. However the other problem is a common one experienced when trying
to synchronize combos on a continuous form. Here's part of a post I made to
a thread on a similar problem today:

When you use this technique (synchronizing combos) on a continuous form you
get strange looking results because though you see multiple rows, there is
actually only a single combo box control with a single rowsource. Whatever
you do to that control will be apparent in all rows. When you restrict the
values in the combo box by some other value (Category in your case) and you
have a visible record that does not meet that criteria the combo box for
that row will appear empty. This is a little disconcerting to the end user
so you have to do a little extra work to avoid this problem.

To create the effect of a synchronized combo in a continuous form create
another textbox control, include the display column of the combo in the
Recordsource query of the form (join the foreign table and drag in the
column). Position and size the new textbox so that you can place it directly
over the combo box allowing only the down-arrow portion of the
combo to show.

Create a GotFocus event for the textbox that only does a SetFocus to the
combo.

This will create the effect that you are wanting - the correct display value
will always show even though the value itself might not be fit the criteria
that is in effect based on the current record.

Here's a link to my sample database that offers several different
alternatives for displaying this type of data including the technique
described above:
http://www.daiglenet.com/msaccess.htm

Also, here's a KB Article that explains the problem ACC2000: Combo Box in
Continuous Form Shows Incorrect Data
http://support.microsoft.com/default.aspx?scid=kb;en-us;208866
 

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