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!

Disable cmd button based on record count

Status
Not open for further replies.

ba4crm

Technical User
Dec 19, 2003
92
US
I have a frmMain with a sub-form of sfrmSecond. I included a record count on the OnCurrent event of the sfrm (Me.txtRecordCount.Value = Me.Recordset.RecordCount). I would like to reference this on the main form and then disable a command button if the record count exceeds 21. I tried to follow this code (from a thread on this topic) (Create text box on subform and referencing it on main form
Forms!frmMyForm!SubFormControl.Form.RecordsetClone.RecordCount) to include the count on the main form without success.
Can you provide some insight into how I am supposed to reference the count on the main form?
Thank you
 
On your main form you might try:

If CInt(Form_sfrmSecond.txtRecordCount.Value) > 21 Then
cmdButton.Enabled = False
End If

-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top