Bob Vance said:
On my Main Form that stays open I have a list box [lbTaxChange] that is
based on a query it is not Visible but I have another text box that is
visible showing how many are tax Changed.
=[lbTaxChange].[ListCount]
When I go to another form and change the Tax, because my main form is
still open it will not refresh/requery the List box until I close my db
and re open it
First question: is the list box always invisible? If so, why use a list
box instead of a just using a DCount expression in your text box? I can
imagine that possibly you extract other info from this list box; I'm just
asking to make sure there isn't an easier way to do this.
With your current setup, I belived you're going to have to do two things
in the AfterUpdate event of the form where you change the tax: (1)
requery the list box, and (2) requery (or maybe recalc) the text box that
displays the ListCount. But you don't want to do those things if the Main
Form is not open, so you should check that first. Your code in the Tax
form might look something like this:
'----- start of example code -----
Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("Main Form").IsLoaded Then
With Forms("Main Form")
!lbTaxChange.Requery
!txtTaxCount.Requery '*** change to correct name
End With
End If
End Sub
'----- end of example code -----
Note that you may have to change "Main Form" to the name of your form, if
it's not correct, and you probably have to change "txtTaxCount" to the
name of the text box on that form.
If the line
!txtTaxCount.Requery
(with the name corrected) doesn't work, then try this line instead:
.Recalc
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)