CmdButtonInVisible

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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)
 
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.
 
Stephen, Hi. I'm looking at the sample MDB file but which function should I
try to modify?

Thanks
 
Back
Top