Re: Automatically Input Date

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Linda:

"Me." is a shorthand way to refer to the current active object, in this case
presumably the form. So "me" = "the form", and "DateField" = "the name of
the control that holds the value for the date".

But, really, Jeff's answer is better - is it showing up in your newsreader?
In case it isn't I repeat it here for you:

/Quoting a smarter man than me.. ;)

Add a Default property of "Date()" (to get today's date) or "Now()" (to get
the current date/time) to the control that binds to the field in your table
that records the date of the new record.

Note: "Date" is a reserved word in Access -- use a different name for the
field.

/End Quote

Cheers!

Fred

"Linda" <Linda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C1054508-DDC8-40DD-80F7-365ED516AC12@xxxxxxxxxxxxxxxx
Hi Fred,

Waht do I replace the Me. with?

Thanks
Linda

"Fred Boer" wrote:

Hi Linda:

Assuming you are using a form, in the On Current event for the form, put
code like this:

If Me.NewRecord Then
Me.DateField = Date
End If

HTH
Fred

"Linda" <Linda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1258625B-B823-4F6B-813A-B508646F57F7@xxxxxxxxxxxxxxxx
Hi,

I need to be able to have Access 2000 automatically input Date only
when
it
is a new record. How would I do this?
If the user is editing an old record and saving it, I do not want the
date
to change to the current date.

Thanks
Linda





.



Relevant Pages

  • Re: Me. vs Me!
    ... syntax may only be used in a class module (which I don't believe ... you can use Me.controlname or Me!controlname to refer ... running behind FormA you can refer to control txtFieldOnA on FormA using ...
    (microsoft.public.access.modulesdaovba)
  • RE: Selecting columns from a query by using a form
    ... refers to a control on the currently active form or report. ... you have code behind a form or a control on the form, you can refer to any ... not what you see in the listbox. ... Fieldname where Fieldname is a text of the name of the column to be ...
    (microsoft.public.access.forms)
  • Re: forms and variables help please
    ... To refer to a control on the New form where the control name is a variable, ... Doug Steele, Microsoft Access MVP ... On stepping through my code i know that the name of the textbox is being ...
    (microsoft.public.access.formscoding)
  • Re: need to get form property
    ... The Me prefix means that what follows is a property of the form in which the ... refer to anything specific about the form, but rather sets the table for what ... an event for an individual control. ... then the bang operator is needed. ...
    (microsoft.public.access.forms)
  • RE: Why cant I open a report using VB?
    ... you now have no criteria in the query that refers ... is to check that the control that you refer to to populate the variable ... The query used to refer to "Forms!frmDrive!TestID", ... It works when I call the report straight from the database window ...
    (microsoft.public.access.modulesdaovba)