Label visabilty based on dcount expression. Refresh not working

Inijjer

New member
Local time
Today, 16:31
Joined
Apr 12, 2013
Messages
6
I'm looking for some help regarding refresh. I have a main form. I open a second form and add records. I want a label on the main to indicate whether I have records in the 2nd form/ table relating to the displayed record or not and change if I remove all the records or add a new record.


I first created a label, I did a dcount expression within this label showing me how many records relate to this record in the first. I did a me.refresh expression on the close property of the 2nd form and this worked.


However if I try to link a label display property to this label (ie display if >0) then it doesn't display using refresh. I even tried removing the intermediary label to see if I count dcount within the code if that would work. requery works but it sends me back to first record on the main form and I don't want that.
Any advice?
 
Have tried recalulating the text box that uaes the DCount() expression by using Recalc instead of Refresh or Requery. Syntax would be something like:
Forms!YourFormName.YourTextBoxName.Recalc
 
Have tried recalulating the text box that uaes the DCount() expression by using Recalc instead of Refresh or Requery. Syntax would be something like:
Forms!YourFormName.YourTextBoxName.Recalc

Thanks Bob.

Thats tidied the code up but still have the problem. The text box changes number. But my if statements that change the label visible or not visible doesn't update itself

I'll try the bookmark method later, but Iwant to understand why the refresh / recalc method doesn't work. In my mind the label should blink on or off depending on the value of the number in the text box but it doesn't.
 
Maybe I misunderstanding what you want, but can't you use the "On Current" event?

Below is some code that shows how many records a subform has, in a label!
Code:
Private Sub Form_Current()
  Me.Parent.SubFormCount.Caption = Me.Recordset.RecordCount
End Sub
 

Users who are viewing this thread

Back
Top Bottom