Place date on form when execute command button

G

Guest

I have a form that has several command buttons that execute different queries
and either displays in a report or export to excel.

However, one of the command buttons "updates" - runs several queries to
update the data tables. I want to be able to add an updated last field onto
the form so that when people click on the update command button it displays
the last time date was updated.
Any help is much appreciated
 
G

Guest

I thought it would be a simple case of adding

YourDateField = date()

to the command button. You would need to add a field to the table.
 
G

Guest

The command works to display the date, but how do you get it to save in the
form field so that when the file is opened it will display the date again.
Now, when I close then re-open the file, the date is no longer displayed.

I added a text box field to the form and added the code
Nameoffield= date() in the code of the command line

code reads
Private Sub Command52_Click()
DoCmd.OpenQuery "Build Temp Store List"
DoCmd.OpenQuery "Check for new stores"
DoCmd.OpenQuery "Update Store List"

DoCmd.SetWarnings True

updatedate = Now()

end sub
 
M

missinglinq via AccessMonster.com

ScubaDiver told you:

"You would need to add a field to the table."

and use the new field as the ControlSource for the textox that you're
assigning the date to. Remember, if your under lying RecordSource for your
form is a Query, after adding the field to your table, you'll have to add it
to the Duery as well.

The command works to display the date, but how do you get it to save in the
form field so that when the file is opened it will display the date again.
Now, when I close then re-open the file, the date is no longer displayed.

I added a text box field to the form and added the code
Nameoffield= date() in the code of the command line

code reads
Private Sub Command52_Click()
DoCmd.OpenQuery "Build Temp Store List"
DoCmd.OpenQuery "Check for new stores"
DoCmd.OpenQuery "Update Store List"

DoCmd.SetWarnings True

updatedate = Now()

end sub
I thought it would be a simple case of adding
[quoted text clipped - 10 lines]

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
G

Guest

I added the field to the table and input the control source through the
builder (as the form is not linked to a table but just executes queries)

However, now I get a #name in the field and when I click the command button
to exectue the update queries - I get an error message

"You can't assign a value to this object"
 
G

Guest

Make sure the new date field is in the query you are using as the source for
the form.

"#name" means it can't recognise the field.
 

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

Top