Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Combo not Refreshing on navigation?? 1

Status
Not open for further replies.

misscrf

Technical User
Jun 7, 2004
1,344
US
I have a main entry form which I am currently debugging before deployment. This form has a tab control with subforms.

On a subform there is a combo box. Based on the choice made, a certain combo (cboA) will become visible with a list of choices to choose from (3 choices in cboA - 3 combos (cboB, cboC, cboD) which each become visible depending on choice made).

This all works fine and the records store correctly. The issue is that if I go to a new main record and back to this one, cboA on this subform will show the choice that had been chosen, but cboB (made visible by cboA) is now not visible. If I choose another choice in cboA, the cboC, and if I choose the original choice cboB becomes visible with the filtered choice still made.

How do I get the main form and subform nagivation code to force a refresh for the first combo choice code to refresh the visiblity of the correct secondary combo, please? I use this method in a few places, so whatever the solution, I will be putting it in a bunch of spots.

This is the code that I have on chage of the cboA
Code:
If IsNull(me.cboA) Then
Me.cboB.Visible = False
Me.cboC.Visible = False
Me.cboD.Visible = False
ElseIf me.cboA = 1 Then
Me.cboB.Visible = True
Me.cboC.Visible = False
Me.cboD.Visible = False
Me.cboB.Requery
ElseIf me.cboA = 2 Then
Me.cboB.Visible = False
Me.cboC.Visible = True
Me.cboD.Visible = False
Me.cboC.Requery
ElseIf me.cboA = 3 Then
Me.cboB.Visible = False
Me.cboC.Visible = False
Me.cboD.Visible = True
Me.cboD.Requery

Any thoughts???

Thanks!

misscrf

It is never too late to become what you could have been ~ George Eliot
 
I'd put some similar code in the Current event procedure.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
on current of the subform?

I will try that and see how it works.


misscrf

It is never too late to become what you could have been ~ George Eliot
 
How are ya misscrf . . .

Trimming the code a little:
Code:
[blue]   Dim valA As Long
   
   valA = Nz(Me!cboA, 0) + 1

   If valA <= 4 Then
      Me!cboB.Visible = Choose(valA, False, True, False, False)
      Me!cboC.Visible = Choose(valA, False, False, True, False)
      Me!cboD.Visible = Choose(valA, False, False, False, True)
   End If[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Woops! [blush} ... forgot the requery:
Code:
[blue]   Dim valA As Long, cbxName As String
   
   valA = Nz(Me!cboA, 0) + 1

   If valA <= 4 Then
      Me!cboB.Visible = Choose(valA, False, True, False, False)
      Me!cboC.Visible = Choose(valA, False, False, True, False)
      Me!cboD.Visible = Choose(valA, False, False, False, True)
      If valA > 1 Then Me(Choose(valA, "", "cboB", "cboC", "cboD")).Requery
   End If[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks, Aceman!!! I have to deploy my app today to get it out, but I will probably update it to clean up this code in version 2.0 lol.

I appreciate it!!!

misscrf

It is never too late to become what you could have been ~ George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top