Date/Time Upload

dr223

Registered User.
Local time
Today, 08:53
Joined
Nov 15, 2007
Messages
219
Hallo,

On my main form I have a text box which saves the date and time after an update. The code I use is shown below

Me.txtlastupdated = Now()

tstlastupdated is the name of the text box which displays the date and time. Therefore, when any field is updated the date and time is saved.

Now, I have a checkbox and I want to save the date and time when someone either checks or unchecks it ONLY. The name of the Upload check box is called Upload and the name of the textbox to display the date/time is called lastuploaded...

Any help please!!!!
 
Me.txtlastupdated = Now()

This doesn't save anything. It just displays it. Assuming that is what you want, create a check box on your form then use the code:

Code:
If Me.checkBoxName Then
Me.txtlastupdated = Now()
End If
 
Date/Time upload

Thanks for your response.. Do I put it on the BeforeUpdate of the main form?Because if i do so it still changes when a different field on the form is changed.

It should only be changed when the Checkbox is updated.

Any ideas
 
Thanks for your response.. Do I put it on the BeforeUpdate of the main form?Because if i do so it still changes when a different field on the form is changed.

It should only be changed when the Checkbox is updated.

Any ideas

:confused: You're confusing me now. Could you post your db or even a screen shot of your form. I'm not sure what you want to achieve.

Do you want an object on your form that when you click it, it updates a text box with the current time and date? If so a button would be better than a check box.
 
What's going on with your table structure? There's tables that blatantly should have a relationship but don't.

You really need to sort that out before your forms. It will make things alot easier.
 
I'm going to answer this in two parts -

1. I'm not going to look at the structure because I've already seen it and know that it needs help.

2. The answer to the original question is that you would put the code in the After Update event of the CheckBox.
 
Thank you Boblarson,

Is the database crap, please tell me how I can improve it. I am new to Access...

Secondly, I tried to put the code shown below on the checkbox After event. When I am in Form view and check or uncheck the box, the textbox is blank. It does not bring forward the date and time.
The code I used was;


If Me.lastupdated Then
Me.lastupdated = Now()
End If



Thank you
 
My advice is stop what you're doing. Bin your current DB, chalk it up to experience. Read up on Normalisation and start again from scratch.

I did exactly the same as you. I ignored normalisation at my peril and had to bin weeks of work.

You're in a real mess with your current DB, and it'll only get worse as you try to add more functionality.

Please trust me as I was in the exact same position 3 weeks ago. Now I'm on the verge of completeing my first DB. It took ages to struggle to where I got to before I learned about normalisation. Now, it's taken a few weeks to nearly finish the whole thing. It's ALOT easier if your tables are normalised, it's not just something for the 'experts'.
 
If Me.lastupdated Then
Me.lastupdated = Now()
End If

So, you've given the checkbox and the textfield the same name? How is Access supposed to tell the difference between the two?
 
Thanks JEA I'll try my best to learn

I did't mean to sound patronising. I hate communicating in text (much to my wife's dispair with SMS messages :rolleyes: ) as I lack a good enough command of the English language to express myself like I would with speach. (Even though it's my 1st, and only, language) :o

Reading the above posts back to myself, they seem quite agressive and condacending. They were ment with genuine sympathy as I know how it feels to have to bin a lot of hard work.:(
 
Last edited:
Its ok JEA, I took it on a positive perspective. Thanks for being considerate.....

Lovely Christmas, Cheers!!!
 

Users who are viewing this thread

Back
Top Bottom