Question about dating

C

Craig

I currently use Access templates (e.g., invoice, purchasing, etc) based on
Northwind (came with 97 Office Suite). Now, I currently use the same
templates for 2002 Access.

My question is about dating in the access files. When I open the previous
invoices (or purchasing orders), the date changes to the current date.
Then, I have no idea when the original documents were created.

Please advise me how to keep the date unchanged when the document was opened
later date. TIA. Craig
 
R

Rick Brandt

Craig said:
I currently use Access templates (e.g., invoice, purchasing, etc)
based on Northwind (came with 97 Office Suite). Now, I currently use
the same templates for 2002 Access.

My question is about dating in the access files. When I open the
previous invoices (or purchasing orders), the date changes to the
current date. Then, I have no idea when the original documents were
created.
Please advise me how to keep the date unchanged when the document was
opened later date. TIA. Craig

What code event are you using to set the date? You should be using a default
value or the BeforeInsert event. Sounds like you are using the Current event
which fires every time the form loads a record.
 
C

Craig

I thought that the date field for the invoice (i.e., Northwind) was never
been touched.
So it must be the default setting.
I looked up the field code for the date under "Design" mode.
It is "=Format(Date(),"Short Date")".
Craig
 
R

Rick Brandt

Craig said:
I thought that the date field for the invoice (i.e., Northwind) was
never been touched.
So it must be the default setting.
I looked up the field code for the date under "Design" mode.
It is "=Format(Date(),"Short Date")".
Craig

That means you aren't storing the date at all. All you have is a TextBox that
always displays the current date. If you check your table you will likely see
that the date field is empty.

You need to set the ControlSource of the TextBox to the name of the date field
in the table and then set the Default value property to =Date() or =Now()
depending on whether you want only the date or both the date and time.
 
C

Craig

Thanks Rick,

I changed the CtronlSource from "=Format(Date(),"Short Date")" into
"=Date()".
I will see how it works tomorrow.
Thanks again.
Craig
 
R

Rick Brandt

Craig said:
Thanks Rick,

I changed the CtronlSource from "=Format(Date(),"Short Date")" into
"=Date()".
I will see how it works tomorrow.
Thanks again.
Craig

No. If you want the date to be saved to your table then the ControlSource needs
to the name of a field in the underlying table. All you did was remove the
format() function. You still have a TextBox that will ALWAYS display the
current date because that is what you are asking it to do.

=Date() needs to be the DefaultValue property, not the ControlSource.
 
C

Craig

Rick,
=Date() needs to be the DefaultValue property, not the ControlSource.

The last time I edited Northwind was about 5 years ago.
Now, my memory on the editing Access faded too fast.
I even could not figure out where to find "DefaultValue properties"?
Need your help. TIA. Craig
 
J

John Vinson

The last time I edited Northwind was about 5 years ago.
Now, my memory on the editing Access faded too fast.
I even could not figure out where to find "DefaultValue properties"?
Need your help. TIA. Craig

PMFJI...

You need to open the table design view of the Table upon which the
form is based, not the Form. (Data is stored in tables, and only in
tables.)

If the table has an InvoiceDate field (whatever its name might be),
select that field in table design view. In the lower left corner are
the field's properties. One of them is the Default Value; set it to
=Date().

If there is no such field, add one - Date/Time datatype.

You'll then need to be sure that the Form's Recordsource property
contains the field (click the ... icon by it in Form Design view, open
the Query window, add the field if necessary); set the control source
of the invoice date textbox to the fieldname.

John W. Vinson[MVP]
 
C

Craig

I now realized that I did not describe exactly where the date problem was..
In table, there are ordered and shipped date columns.
Once those dates were typed in the table, the date does not change.
These dates are just fine. .

The question is about the date when the invoice form was created (say
"created date").
It is just like typing in date when you compose a letter or a fax
document.
This date is not in the table but included in a date combo on the design
form .
(the created date prints on the top of the page and just under the INVOICE).
The field code for the date was : =Format(Date(),"Short Date").

Hope I made it clear the problem.
Craig
 
R

Rick Brandt

Craig said:
I now realized that I did not describe exactly where the date
problem was.. In table, there are ordered and shipped date columns.
Once those dates were typed in the table, the date does not change.
These dates are just fine. .

The question is about the date when the invoice form was created (say
"created date").
It is just like typing in date when you compose a letter or a fax
document.
This date is not in the table but included in a date combo on the
design form .
(the created date prints on the top of the page and just under the
INVOICE). The field code for the date was : =Format(Date(),"Short
Date").
Hope I made it clear the problem.
Craig

There is no date "when the invoice was created" unless you store it somewhere.
This needs to be a field that you add to your table.
 
C

Craig

I also use Word and Excel templates. Dates are always changing to current
date whenever documents are open.
But those date can be modified not to change after one or two manual
strokes.
I wish that there is a similar way to do so on =Format(Date(),"Short> Date"
for Access without involving table.

Craig
 
R

Rick Brandt

Craig said:
I also use Word and Excel templates. Dates are always changing to
current date whenever documents are open.
But those date can be modified not to change after one or two manual
strokes.
I wish that there is a similar way to do so on =Format(Date(),"Short>
Date" for Access without involving table.

You have to understand that the form is only a viewport to the data in your
table. You can have a control on a form always display the current date as you
have now. You can also have a form that will always display a particular date by
just adding a label on it with the date you want to see as text in the caption
of that label.

Now...if you want to see a date on your form that is specific to a particular
record in your table then it has to be stored as part of that record (in a
table). It has never been clear to me in any of your posts just what you want
this date on your form to be.
 
J

John Vinson

The question is about the date when the invoice form was created (say
"created date").
It is just like typing in date when you compose a letter or a fax
document.
This date is not in the table but included in a date combo on the design
form .
(the created date prints on the top of the page and just under the INVOICE).
The field code for the date was : =Format(Date(),"Short Date").

Hope I made it clear the problem.

Well... again...

If the date isn't in the Table, you need to change the Table.

End of story.

Putting it in the Form as you're doing will NOT STORE IT ANYWHERE.

John W. Vinson[MVP]
 
C

Craig

I am simply an end-user. So I am not in a position to argue on this matter.
Indeed the date is not in the table.
If you have 97Access, take a look at Northwind sample file (NWIND.MDB).
Open Reports: invoice. At the top right corner, you would see the word
"Invoice". Below the Invoice, date is printed.
This date is not in the table. The field code for this date is
"=Format(Date(),"Long Date")".

Again, my invoice is modified based on Northwind.

Craig
 
J

John Vinson

I am simply an end-user. So I am not in a position to argue on this matter.
Indeed the date is not in the table.
If you have 97Access, take a look at Northwind sample file (NWIND.MDB).
Open Reports: invoice. At the top right corner, you would see the word
"Invoice". Below the Invoice, date is printed.
This date is not in the table. The field code for this date is
"=Format(Date(),"Long Date")".

I'm not arguing with you, Craig.

I understand that this is how the form works.

The way the form works will not let you accomplish the design change
which you wish to make.

Northwind does not store the invoice date. Any time you generate an
invoice using Northwind, it will give it today's date. That's exactly
what this code does, and that's what it's designed to do.

I gather that you want your form to behave differently - you want it
to store the date for later use.

If you wish to do so, the way - the ONLY way - is to do as we have
suggested, by adding a new InvoiceDate field to the table with a
DefaultValue property of =Date(), and to bind this field to the
textbox in your form.


John W. Vinson[MVP]
 
C

Craig

Thanks.
That's what I learned.
I am planning to modify during the upcoming holiday.

Happy Thanksgiving to all who responded to my post!

Regards,

Craig
 

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

Similar Threads


Top