A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Count Instances in a table field



 
 
Thread Tools Display Modes
  #1  
Old April 15th, 2010, 08:21 PM posted to microsoft.public.access.forms
gagecres
external usenet poster
 
Posts: 36
Default Count Instances in a table field

Here's a little background on my database. I have a form with a couple of
buttons that I have grayed out when the database is empty. These buttons
open a print preview of a couple of reports. I would like to ungray these
buttons only when there is at least one record with a "CA" entry in the State
field in my main table. How do I do this?
  #2  
Old April 15th, 2010, 08:36 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Count Instances in a table field

Forms display data from tables. I'm not understanding why you'd want a form
to enable (ungray) a button if ANY record has a "CA" entry. Wouldn't you
want to ungray the form if the record DISPLAYED had "CA"?

Since I'm not there, I don't have a clear idea on what your business need
might be...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"gagecres" wrote in message
...
Here's a little background on my database. I have a form with a couple of
buttons that I have grayed out when the database is empty. These buttons
open a print preview of a couple of reports. I would like to ungray these
buttons only when there is at least one record with a "CA" entry in the
State
field in my main table. How do I do this?



  #3  
Old April 15th, 2010, 09:11 PM posted to microsoft.public.access.forms
gagecres
external usenet poster
 
Posts: 36
Default Count Instances in a table field

Never mind. I figured it out. I used the DCount function in an If statement:

If DCount("*", "Property Table", "[STATE] = 'CA'") 0 Then
Me.cmd_Prnt_All_CA_Ltrs.Enabled = True
Me.cmd_Prnt_Unprntd_CA_Ltrs.Enabled = True
End If


"gagecres" wrote:

Here's a little background on my database. I have a form with a couple of
buttons that I have grayed out when the database is empty. These buttons
open a print preview of a couple of reports. I would like to ungray these
buttons only when there is at least one record with a "CA" entry in the State
field in my main table. How do I do this?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.