Senin, 06 Maret 2017

Re: [MS_AccessPros] Initialize Date Field to Today's Date

 

David-


Wrong event.  At the Open event, you get notification that the form is about to open, but it isn't loaded yet, so that's why you get the error.  If you do it in the Load event, you'll set the date only for the first record loaded, and that record will be "dirty", so moving to another record will save the record regardless of whether any other changes have been made.  Ditto the Current event - you'll store the date for every record accessed.  I would think it would be best to do this in the form Before Update event - store the date just before an update to any other field is saved.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Mar 6, 2017, at 4:54 AM, david.pratt@outlook.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



I have a simple form based on a query that includes a field ModifyDate.  When the form opens I want to initialize the ModifyDate field value to = today's date.

In the forms Open Event, I have tried:
  me.txtModifyDate = Date
 also me.txtModifyDate = Date() (and the VBE strips off the parentheses each time) 
 and now() and Today()

 also txtModifyDate = Date (and Date(), Today(), Now()

It gives me error 2448; "You cannot assign a value to this object"

This should be very simple but I cannot figure out what I am doing wrong.





__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar