Hide command button

  • Thread starter Thread starter mikeinohio
  • Start date Start date
M

mikeinohio

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
way?
 
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:

Me!txtMedStartDate.SetFocus

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
Else
...

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?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top