CmdButtonInVisible

G

Guest

I have cmdbuttons on a continuous form with links to files in a directory
outside Access. Is there a way for me to make the cmdbutton invisible if the
corresponding file is not in the directory??

Thanks You in Advance
 
P

pietlinden

One way:
1. create a function that returns a boolean value, something like

Function FileExists(byval strFullPathToFile as string) as boolean
fileExists=Dir(strFullPathToFile)<>""
End Function

and then you could set the visible property of the button in the
Current event of the form.
(Wait, will that work with a continuous form?)

Would normally be...

Me.cmdSomeButton.Visible=FileExists(me.txtFilePath)
 
S

Stephen Lebans

No, CF does not work with CommandButton controls. WHat you could do is use a
TextBox control, Disabled, containing say a Check character. You could then
set the ForeColor prop to the same as the BackColor prop when the file is
not in the directory.

This sample MDB contains sample code showing you how to accomplish this by
having CF evaluate a custom function of your design as it displays each row.
http://www.lebans.com/conditionalformatting.htm
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

Stephen, Hi. I'm looking at the sample MDB file but which function should I
try to modify?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top