Disabling a control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a text box named "vault_no" on a form. When the form opens if
"vault_no has data in it, I want a print button named "command43" to be
disabled. I used the following code and many variations but I could not get
it to work. Thanks for any help!!!

If Me!vault_No = IsNull() Then
Me!Command43.Enabled = True
Else
Me!Command43.Enabled = False
End If
 
The correct syntax use of IsNull would be like so:

If IsNull(Me!vault_No) Then
Me!Command43.Enabled = True
Else
Me!Command43.Enabled = False
End If

However, you could simplify all of that code onto one line:

Me!Command43.Enabled = IsNull(Me.vault_No)

BTW, you may want to rename that command button to something
more useful. Perhaps cmdPrint or something. That would make
checking over your code easier in the future.

--
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html

in message:
 
Jeff, thank you very much. That works just fine! Do you know of a good
reference book that I could buy to help me with Access/VBA/Macro's. I like
thinking of things to do but when I can't make them work....
 

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

Back
Top