Activate a command button following an event

N

Nick T

Hi,

I have a text box on my form and also a command button for which when
clicked, the form is printed.
However, i do not want users to be able to print the form unless data is
entered into the text box. Is there any code i can put in the text box event
which eg: 'AfterUpdate activate 'Print Button' ??

At all other times i want the 'Print Button' to be inactive.

Any suggestions greatly appreciated.
Thanks
Nick
 
P

pietlinden

Hi,

I have a text box on my form and also a command button for which when
clicked, the form is printed.
However, i do not want users to be able to print the form unless data is
entered into the text box.  Is there any code i can put in the text box event
which eg: 'AfterUpdate activate 'Print Button'  ??

At all other times i want the 'Print Button' to be inactive.

Any suggestions greatly appreciated.
Thanks
Nick

Check the length of the text in your textbox

me.cmdPrint.Enabled=(Len(Trim(Me.txtEnterData))>0)

then if the user has entered spaces or nothing, the print button will
remain disabled.
 
N

Nick T

Hi.
I cant seem to get this to work??
If to simplyfy explanations we say im using a command button. In the on
click event i put the code: me.cmdPrint.Enabled=(Len(Trim(Me.txtEnterData))>0)

Am i supposed to set the properties of my print command button to 'Enabled -
NO'??

Any further help greatly appreciated
Thanks
Nick
 

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