Populating date with button click

chriscardwell06

Registered User.
Local time
Today, 11:34
Joined
Aug 18, 2011
Messages
38
So I have a continuous form and I have a button that is pressed when a job is released and it record a date in a field. I wanted to turn that button to disabled after pressed but after lots of reading found that it couldn't be done in a continuous form due to it disabling all buttons :banghead:. So I decided to just make the code populate the field only if it was a null value so that it wouldn't overwrite a value if someone pressed it more than once. Well the null is my downfall in all this. I cannot make it compare and populate the date when the button is pressed. I have tried all I can find on the net and all I can think of. Any suggestions would greatly be appreciated.
 
I thought I had read you couldn't use conditional formatting to disable a button???
 
Sorry, yes you are right -I forgot to say you create an unbound texbox that you format to look like a button - or hyperlink style.

Release Job
 
I read about the text box to look like a button trick but couldn't figure out how to code it in conditional to disable it. I am open to either way I just cannot figure out for the life of me the code for them.
 
Can you navigate to the conditional formatting tab on the ribbon? If so, then look at the attachment in my previous post
 
I saw the attachment but I wasn't sure what else I needed in there. Basically saying that if [released to prod date] <> "" then release button is disabled else enabled. I am still very green with the conditional side of things.
 
that is almost correct in interpretation.

A better interpretation would be 'If no conditions are met then use the design formatting'

Quite frankly, the best way to find out is to try it:)

The other thing to say is that if [released to prod date] is a date then you should use isnull([released to prod date])=false. Whatever formula you use, it must result in either true or false, and if true the conditional formatting will be used.

Once a condition has been met then the code exits with the result so for example if you wanted to use different colours to indicate levels of urgency you might have

Condition1=datediff('d',[SomeDate],Date())<5
format background as Red
Condition2=datediff('d',[SomeDate],Date())<30
format background as Orange

which is effectively saying
"If SomeDate is within 5 days of today then set background to red else if somedate is within 30 days of today then set background =orange otherwise do not change background"

If you were to swap those conditions round then as soon as it is within 30 days the background will go orange and it will never go red because the first condition has been satisified

Hope that helps
 
Just realised I don't think you understand what I am saying

I have a button that is pressed when a job is released and it record a date in a field

If [released to prod date] is the name of your button then this is what you change to a text box, formatted to look like a button and the control on which you apply the conditional formatting.

The field referred to in my attachment is the field referred to in your quote above in red
 
That worked perfect. I finally understood and my novice self finally caught that there was a disable check box in there. Now the only thing is that I have some code in the on click event that says me.release_to_prod_date.value = date and it will not populate the date...

I had it working this morning but couldn't get the button to disable. I even tried removing the .value or using brackets and got nothing. Any suggestions there?
 
Sounds like the Textbox that looks like a button is disabled? Or do you need to copy the vba from the button on click event to the textbox that looks like a button on click event?
 
That got it! Somehow it had the correct heading in vb but it wouldn't take. I blew it out and placed it back in and magic! Thanks for all your help!!!
 

Users who are viewing this thread

Back
Top Bottom