Buttons Enabled or Disabled

J

Jeff Garrison

I have a form that has buttons in the detail section of the form (Attach
File, View Attachment, Delete Attachment). I want to have the View
Attachment and Delete Attachment buttons disabled unless there is something
is a text box (AttachmentPath). I've set both of the button's Enabled
properties to No. I also have some vba in the On Current for the form as
follows:

If Not IsNull(AttachmentPath) Then
cmdViewAttachment.Enabled=True
End If

It works fine if there is something in the AttachmentPath control, but on a
new record, it is enabled as well. I'd like for both buttons to be disabled
unless there is something in the AttachmentPath field.

How can I fix this so to do what I want?

Thanks

JeffG
 
D

Damon Heron

If Not IsNull(AttachmentPath) Then
cmdViewAttachment.Enabled=True
else
cmdViewAttachment.Enabled=false
End If


Damon
 
D

Damon Heron

Another approach might be to put the code in a subroutine and call it from
the current event and also from the textbox afterupdate event. This would
ensure the user doesn't leave the attachmentpath textbox in a null state and
also, on a new record, the command button will be enabled immediately upon
an entry made in the textbox

Damon
 

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