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.

show hide command button depending on a value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CarWashMike - 18 May 2008 11:30 GMT
Hi
I have a list of jobs outstanding dispayed on a form based on a query
listing the jobs. The from view is set to  continuous forms, the detail
section is where the data is shown similar to dataseet view.  I have a
command button in the detail section which opens another form to display
additional information. I only want the user to see the command button if
there is any additional information to be seen. I have a control on the form
which shows the number of records (if any) there are so I though I could say
If me.TheControlValue > 0 Then me.CommandButton.Visible = True End If. I put
this sub in the on current event of the form but the button is visble for
every record if one record satisfies the If statement. Any advice would be
great
Mike
Stuart McCall - 18 May 2008 11:53 GMT
> Hi
> I have a list of jobs outstanding dispayed on a form based on a query
[quoted text clipped - 12 lines]
> great
> Mike

If you're going to use the construct:

If <some condition> Then CommandButton.Enabled = True

then you must have a corresponding CommandButton.Enabled = False elsewhere.

If however you code it like this:

CommandButton.Enabled = (me.TheControlValue > 0)

it will cover both cases. The part between the parens is evaluated as an
expression returning True or False.
CarWashMike - 18 May 2008 19:43 GMT
thanks for the tip, I tried it out but I still have the problem that if I
click on one record on the form that give me the answer "True" (ie the
control >0, ) then the command button is visible on all the forms (it is
continuous forms). If I can use conditional fomatting on controls on the from
and that is different for each one but I cant use conditional fromatting on
the command button.


> > Hi
> > I have a list of jobs outstanding dispayed on a form based on a query
[quoted text clipped - 25 lines]
> it will cover both cases. The part between the parens is evaluated as an
> expression returning True or False.
Stuart McCall - 19 May 2008 00:43 GMT
> thanks for the tip, I tried it out but I still have the problem that if I
> click on one record on the form that give me the answer "True" (ie the
[quoted text clipped - 41 lines]
>> it will cover both cases. The part between the parens is evaluated as an
>> expression returning True or False.

Ah, continuous form. No wonder you can't make it work. On a continuous form,
all the detail section rows are clones of the first one, so whatever changes
you make to visibility (or just about anything else) will be repeated for
the whole dataset. No way around this one (AFAIK).
 
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.