Automatically Update Date Field

Dreamboat

Smack in the Middle
Local time
Today, 05:14
Joined
Jun 24, 2000
Messages
106
How can I set a control in my form to put "today's" date in when I have changed any value on the form? Any direct or indirect help appreciated. Thanks.
 
shouldn't that be the BeforeUpdate event so that the value is saved?
 
Sorry. I should have said--I don't do code; at least not in Access.

Can I build this macro without writing code? Help! I know too much about tables and nothing about the rest.

I also can't figure out how to store col 1 value in my table, but view the col 3 value on my form (via my form's combobox). Anybody?

U gize iz gr8!
 
The only way I know to store today's date as update is the suggestion you got before. Use this code in the before update event of the form.
me!DateFieldName=Now()
Even if you've never coded before this is one of the easiest things to do. In form design view, click on the properties button on the toolbar. Go to the Event tab and click on the BeforeUpdate line. Then click the ellipsis (...) Select Code Builder and type the line of code above (remembering to change DateFieldName to your table's field name)
As for your combo box question: This can be accomplished by changing the combo box properties. If col1 is the primary key for your table, this is easily done with the wizard. It will prompt you to hide key column, selecting this will do exactly as you wish. If col1 is not the primary key, or if you don't wish to re-make the combo box, then go to the format tab on the combo box properties and set the first value of the column widths=0". This should do the trick
 
Okay, I'll try it! Thanks. I'm assuming you mean . when you put ! in the me!

Also, I tried the properties of that combo and asked it to give me the 3rd column. I get an error. I'll post it.
 
The update worked!! Thanks so much!! I got an error when I tried it before, but I put =Date, which was probably wrong, right?

(I'm all over these tech sites answering questions, so it's very funny being the asker...)


"The value you entered isn't valid for that field."

I've got 3 cols: autonumber, one-letter code, description. I'd like to store the autonumber in the record, but see the description. Perhaps I should just get rid of the one-letter code? Prolly, huh?

[This message has been edited by Dreamboat (edited 05-07-2001).]
 
I know what you mean about being on the asking end. Normally my questions are so out there that I can't get an answer. Are you making sure that you're not trying to save a text value in a numeric field?
Look at the rowsource and make sure that you are only listing fields 1 and 3 in the query. Make sure that col1 shows up first. Then changing the column width for the first column to 0 should make access display the third field and save the first. If this doesn't make sense or if you still have problems, could you email me a sample to look at?
 
Thanks for the offer, charity. I've got it working now. I just deleted my autonumber field--there's only about 15 items in the list anyway. Really--thanks so much for helping out.
 

Users who are viewing this thread

Back
Top Bottom