Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2008

Tip: Looking for answers? Try searching our database.

Counting items and setting visible status of button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
magickarle - 28 May 2008 18:22 GMT
Hi, I have a table "Value".
Sometime it has zeros and sometimes ones.
0
0
0

or
0
1
0
0

I have a form with button 1 and button 2.

In a Private Sub Form_Load(), I would like to count the number of
items in Value.
So if it has only zeros, it would display 1 and if it has seros and
one, it would display 2.
If the count is 1, I would like to set buton2.visible=false.
else button2=true
end if.

Thank you for your help as usual!!
Damon Heron - 28 May 2008 19:05 GMT
dim ct as integer
ct= nz(dcount("yourfield","Value","yourfield= 1"),0)
if ct= 0 then        'no 1s present
   me.buton2.visible= false
else
   me.buton2.visible=true
End if

> Hi, I have a table "Value".
> Sometime it has zeros and sometimes ones.
[quoted text clipped - 19 lines]
>
> Thank you for your help as usual!!
Damon Heron - 28 May 2008 19:10 GMT
By the way, "Value" is a sql reserved word, so maybe you ought to name your
table "tblValue".  Early on, I got in the habit of adopting naming
conventions on all the objects in my dbs, like frm for frm, rpt for report,
qry for queries, etc.

Damon

> dim ct as integer
> ct= nz(dcount("yourfield","Value","yourfield= 1"),0)
[quoted text clipped - 27 lines]
>>
>> Thank you for your help as usual!!
magickarle - 29 May 2008 15:44 GMT
> By the way, "Value" is a sql reserved word, so maybe you ought to name your
> table "tblValue".  Early on, I got in the habit of adopting naming
[quoted text clipped - 36 lines]
>
> - Show quoted text -

Thank you for your reply!
Working A1.
thanks a bunch.

I got another question with the same previous example:
Would it be possible to rename the buttons based on the items value.
Ex:I got buton1 named buton1 and buton2 named buton2
I got item 0 and 1 (in the same table "Value" as previous example)
Thank you again
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.