Text box on form

  • Thread starter Thread starter Rey
  • Start date Start date
R

Rey

Hello All,

I would like to put a text box on my main form that would show the
date of the most current records in a specific table.
 
Obviously you have to have a field in the records of your table to hold a
date. Either the creation date, if that's what you want, or the edit date;
whichever fulfills your needs. Then on your main form, a box to display the
date on the most current record. Then place this code in the appropriate sub,
OnLoad perhaps:

YourTextBox = DMax("[CreationDate]", "YourTable")

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

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
If you use the table or query directly and the form is filtered, this could
give incorrect results. It would be better to use the form's recordset:

=DMax("[CreationDate]", Me.Recordset.Name)
 
Obviously you have to have a field in the records of your table to hold a
date. Either the creation date, if that's what you want, or the edit date;
whichever fulfills your needs. Then on your main form, a box to display the
date on the most current record. Then place this code in the appropriate sub,
OnLoad perhaps:

YourTextBox = DMax("[CreationDate]", "YourTable")

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

Answers/posts based on Access 2000

Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200706/1

Do I put this code in the properties of the form? Do I need put
anything in the properties of the tex box?
 
In the Load event of the form.
--
Dave Hargis, Microsoft Access MVP


Rey said:
Obviously you have to have a field in the records of your table to hold a
date. Either the creation date, if that's what you want, or the edit date;
whichever fulfills your needs. Then on your main form, a box to display the
date on the most current record. Then place this code in the appropriate sub,
OnLoad perhaps:

YourTextBox = DMax("[CreationDate]", "YourTable")

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

Answers/posts based on Access 2000

Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200706/1

Do I put this code in the properties of the form? Do I need put
anything in the properties of the tex box?
 
In the Load event of the form.
--
Dave Hargis, Microsoft Access MVP



Rey said:
Obviously you have to have a field in the records of your table to hold a
date. Either the creation date, if that's what you want, or the edit date;
whichever fulfills your needs. Then on your main form, a box to display the
date on the most current record. Then place this code in the appropriate sub,
OnLoad perhaps:
YourTextBox = DMax("[CreationDate]", "YourTable")
Do I put this code in the properties of the form? Do I need put
anything in the properties of the tex box?- Hide quoted text -

- Show quoted text -

Thanks for all the help!
 
"If you use the table or query directly and the form is filtered, this could
give incorrect results. It would be better to use the form's recordset:"

And if the "main form" is a menu form, and there's no recordset open?

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

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 

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

Back
Top