Hide command button



I have a for that has a text box and and a command button that inserts the
date into the text box and they are respectivly called:

txtMedStarteDate and cmdMedStartDate and the calender is called frmCalender,
what ilike to do is once the date is picked i would like to have the command
button disappear until that particular text box is selected again.

I have looked at all the suggested calenders and all of them would totally
require me to redo all my forms and i am an access novice, is ther a simple

Jeff Boyce

If you are saying you'd like Access to hide (consider 'disable' instead - it
may be easier on users if things don't magically appear and disappear) the
command button if there's a value in the txtMedStartDate control, one way to
do this would be to add some code to the command button's "click" event
that, after putting the date in, shifts the focus to the textbox control:


Then, perhaps in the OnChange event for the form, you could test to see if
the textbox holds a valid value and hide/disable the command button:
If IsDate(Me!txtMedStartDate) Then
Me!cmdMedStartDate.Enabled = False

Or what about the idea of removing the command button altogether and letting
the user double-click the textbox to put the current date (or date/time) in
the control?


Jeff Boyce
Microsoft Office/Access MVP

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