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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perform action after count record

Status
Not open for further replies.

JonoB

Programmer
May 29, 2003
147
GB
I have a continuous subform that lists all the Memo's associated with a particular Company (specified on the main form). Each Company can have many Memo's.

Next to each Memo record on the subform, I have a comand button (btnMemoPopup) that opens a new form (popup and modal), showing all of the details associated with each Memo. So, if I have 10 Memo's for a prticular company, there will be 10 btn's. This works fine.

However, the btnMemoPopup appears (just once) in the subform, even if a particular company has no memo's. So I thought that I would hide the btnMemoPoup, unless there were more than 0 records. I created a txtCountRecords control in the heading of the subform that counts how many memo records there are. I then inserted the following code on the "On Open" event of the form:

If txtCountRecords = 0 Then
btnMemoPopup.Visible = False
Else: btnMemoPopup.Visible = True
End If

However, the btnMemoPopup stays hidden even if the count > 0.

Any ideas much appreciated.
 
I think your counter might not be populatet when the on open event of the form runs. Perhaps try another event, the on load or on current?

Roy-Vidar
 
Hi,

I have tried all those options to no avail...

Any other suggestions?
 
Try counting the records in one of those events (on current?).

[tt]if me.recordsetclone.recordcount>0 then[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top