Having Subform update all rows 
Author Message
 Having Subform update all rows

Hello, I have a subform set up as continuous which is bould to a table.  The
controls in subform are combo box which depend on the combo that is selected
next to it.

An example is if you pick A from the first combo the second combo needs to
display AA, AB, AC.

If you pick B from the first combo the second combo needs to display BA, BB,
BC.

During the Got Focus event of the second combo I set it's recordsource =
select [Field] from [table] where [tableid] = Combo1.ID.  This
will display items in the second combo only if it currently matches the
first record.  Here's an example.  Say I tab into Combo2 on Row 4, the got
focus event fires and it sets the text for row 1,4,5.  Now if I tab into
combo2 on Row 3 the text with get filled in for row 3,6.  How do I get the
gotfocus event only to update the currently selected row?

             Combo1  Combo2
Row 1   A             AA
Row 2   B
Row 3   C
Row 4   A            AB
Row 5   A            AC
Row 6   C

             Combo1  Combo2
Row 1   A
Row 2   B
Row 3   C            CC
Row 4   A
Row 5   A
Row 6   C            CA

Thanks




Mon, 19 Jan 2004 05:56:59 GMT  
 Having Subform update all rows

Quote:

> Hello, I have a subform set up as continuous which is bould to a table.  The
> controls in subform are combo box which depend on the combo that is selected
> next to it.

> An example is if you pick A from the first combo the second combo needs to
> display AA, AB, AC.

> If you pick B from the first combo the second combo needs to display BA, BB,
> BC.

> During the Got Focus event of the second combo I set it's recordsource =
> select [Field] from [table] where [tableid] = Combo1.ID.  This
> will display items in the second combo only if it currently matches the
> first record.  Here's an example.  Say I tab into Combo2 on Row 4, the got
> focus event fires and it sets the text for row 1,4,5.  Now if I tab into
> combo2 on Row 3 the text with get filled in for row 3,6.  How do I get the
> gotfocus event only to update the currently selected row?

>              Combo1  Combo2
> Row 1   A             AA
> Row 2   B
> Row 3   C
> Row 4   A            AB
> Row 5   A            AC
> Row 6   C

>              Combo1  Combo2
> Row 1   A
> Row 2   B
> Row 3   C            CC
> Row 4   A
> Row 5   A
> Row 6   C            CA

> Thanks



First, I think a better method would be to set the RowSource property of
[Combo2] in the AfterUpdate event of [Combo1].  

Then in the Enter event of [Combo2] requery it with this method:

Me.ActiveControl.Requery

I don't know where you are getting yout date from, but it looks like it
is coming from a table. and that [Combo1] and [Combo2] RowSources are
both looking at that table.  That being the case, but a Criteria in the
[Combo2] column that is common with [Combo1] the criteria, [Combo1].

FOr example, [Combo1] has columns [Field1]   [Field2]
[Field1] has values A,A,A,A,B,B,B,B,C,C,C,C,D,D,D,D
[Field2] has values AA,,AB,AC,AD,BA,BB,BC,BD,CA,CB,CC,CD,DA,DB<DC,DD

[Combo2] has the columns  [Fields2]   [Field1]
The Criteria for [Field1] should be simply [Combo2]

--
Mark A. Sam
Administrator
www.Truckloads.net
www.YouthKaraoke.Org

Plan-It-Earth Web Management Services
Microsoft Access Database Development
P.O. Box 110
Dunkirk, New York   14048
Phone:   716-679-7607

Website: http://www.plan-it-earth.net



Mon, 19 Jan 2004 22:38:42 GMT  
 Having Subform update all rows
use a third text box to display as the bound source, and the original second
combo box will have an After Update Event code that sets the value of the
third control.  The second combo box will not need to be bound.

HTH


Quote:
> Hello, I have a subform set up as continuous which is bould to a table.
The
> controls in subform are combo box which depend on the combo that is
selected
> next to it.

> An example is if you pick A from the first combo the second combo needs to
> display AA, AB, AC.

> If you pick B from the first combo the second combo needs to display BA,
BB,
> BC.

> During the Got Focus event of the second combo I set it's recordsource =
> select [Field] from [table] where [tableid] = Combo1.ID.  This
> will display items in the second combo only if it currently matches the
> first record.  Here's an example.  Say I tab into Combo2 on Row 4, the got
> focus event fires and it sets the text for row 1,4,5.  Now if I tab into
> combo2 on Row 3 the text with get filled in for row 3,6.  How do I get the
> gotfocus event only to update the currently selected row?

>              Combo1  Combo2
> Row 1   A             AA
> Row 2   B
> Row 3   C
> Row 4   A            AB
> Row 5   A            AC
> Row 6   C

>              Combo1  Combo2
> Row 1   A
> Row 2   B
> Row 3   C            CC
> Row 4   A
> Row 5   A
> Row 6   C            CA

> Thanks





Wed, 28 Jan 2004 18:31:42 GMT  
 Having Subform update all rows
Additional notes to my previous post...
Mark,
I believe he was talking about the problem of dynamic combo boxes on forms
that are set as "Continuous".  When you change the Row Source, it does not
stay specific to the current record row.  For Example:
Say in record #1 we have Combo1 = A.  Combo2 row source now only shows AA,
AB, AC, and we select AA for that value.
Say in record #2 we have Combo1 = B.  Combo2 row source now updates to show
BA, BB, BC, etc.
Now look back at row one... you cannot see the value any more. Because the
combo box row source won't show "A" type values when currently limited to
"B" type values by the requery.  When you change the row source of a combo
box on a continuous-style form, it shows that change on all rows of the form
for the same "repeated" text box.  However, the correct info of each record
IS STORED - if you look at the actual data table you will see the "A" value
is still stored in Record #1, Combo2.  This is why I recommended putting the
actual value selected in a separate bound text box and unbinding Combo2, and
using AfterUpdate event to update the bound text box.  Combo2 can be sized
to hide the text portion and only show the drop-down arrow, since the
selected value will be displayed in the textbox anyway.


Quote:

> > Hello, I have a subform set up as continuous which is bould to a table.
The
> > controls in subform are combo box which depend on the combo that is
selected
> > next to it.

> > An example is if you pick A from the first combo the second combo needs
to
> > display AA, AB, AC.

> > If you pick B from the first combo the second combo needs to display BA,
BB,
> > BC.

> > During the Got Focus event of the second combo I set it's recordsource =
> > select [Field] from [table] where [tableid] = Combo1.ID.  This
> > will display items in the second combo only if it currently matches the
> > first record.  Here's an example.  Say I tab into Combo2 on Row 4, the
got
> > focus event fires and it sets the text for row 1,4,5.  Now if I tab into
> > combo2 on Row 3 the text with get filled in for row 3,6.  How do I get
the
> > gotfocus event only to update the currently selected row?

> >              Combo1  Combo2
> > Row 1   A             AA
> > Row 2   B
> > Row 3   C
> > Row 4   A            AB
> > Row 5   A            AC
> > Row 6   C

> >              Combo1  Combo2
> > Row 1   A
> > Row 2   B
> > Row 3   C            CC
> > Row 4   A
> > Row 5   A
> > Row 6   C            CA

> > Thanks


> First, I think a better method would be to set the RowSource property of
> [Combo2] in the AfterUpdate event of [Combo1].

> Then in the Enter event of [Combo2] requery it with this method:

> Me.ActiveControl.Requery

> I don't know where you are getting yout date from, but it looks like it
> is coming from a table. and that [Combo1] and [Combo2] RowSources are
> both looking at that table.  That being the case, but a Criteria in the
> [Combo2] column that is common with [Combo1] the criteria, [Combo1].

> FOr example, [Combo1] has columns [Field1]   [Field2]
> [Field1] has values A,A,A,A,B,B,B,B,C,C,C,C,D,D,D,D
> [Field2] has values AA,,AB,AC,AD,BA,BB,BC,BD,CA,CB,CC,CD,DA,DB<DC,DD

> [Combo2] has the columns  [Fields2]   [Field1]
> The Criteria for [Field1] should be simply [Combo2]

> --
> Mark A. Sam
> Administrator
> www.Truckloads.net
> www.YouthKaraoke.Org

> Plan-It-Earth Web Management Services
> Microsoft Access Database Development
> P.O. Box 110
> Dunkirk, New York   14048
> Phone:   716-679-7607

> Website: http://www.plan-it-earth.net



Thu, 29 Jan 2004 10:26:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. 2nd SQL Server update after update text field corrupts row - using RDO

2. Insufficent key column information for updating and refreshing:Too many rows to update

3. recordset.update updates > 1 row

4. When updating recordset I get error -2147467259 (to many rows affected by update)

5. cancel changes to row in subform.

6. Position to a row in a subform based on input in the parent form

7. Error creating rows with columns having different column width

8. How to populate data in subforms having multiple records/rows?

9. updating a field in a form from a subform

10. Subform update

11. updating subform

12. updating the contents of a subform from an unbound listbox

 

 
Powered by phpBB® Forum Software