Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Saving the date & time from a form

Geek News

Saving the date & time from a form
Clarkey 12/11/2008 4:28:00 AM
Hi there,

Wondering if someone could assist with some difficulty I'm having with
saving the date and time from a form into a table.

I have a form which displays the Date() and Time() in a text box using the
Control Source property. When the form is opened it automatically inserts
this data. I cant quite work out how to then save the data from these fields
into the table, as the Control Source is what usually links this to the table.

Any solutions?
Re: Saving the date & time from a form
"Al Campagna" <newsgroups[ at ]comcast.net> 12/11/2008 4:54:19 AM
Clarkey,
Sounds like your Date and Time (which really couls be done with just a
Now()) is just a calculated field.
Also, it sounds as though you're trying to capture the Date and Time
the new record is created.

Add a field to your table behind the form, and call it DOC
(DateofCreation), and use that field as the ControlSource of the text
control on your form.
Make the Default Value...
= Now()
Every time a new record is created, the Date and Time will be captured
to the DOC field.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

"Clarkey" <Clarkey[ at ]discussions.microsoft.com> wrote in message
news:AC2329E9-7E1D-4518-9F98-BE2611CC8668[ at ]microsoft.com...
[Quoted Text]
> Hi there,
>
> Wondering if someone could assist with some difficulty I'm having with
> saving the date and time from a form into a table.
>
> I have a form which displays the Date() and Time() in a text box using the
> Control Source property. When the form is opened it automatically inserts
> this data. I cant quite work out how to then save the data from these
> fields
> into the table, as the Control Source is what usually links this to the
> table.
>
> Any solutions?


Re: Saving the date & time from a form
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 12/11/2008 5:02:02 AM
There is a problem with using Now() if you wish to do a between search on a
date range.
I'd keep Date() and maybe use Now() for just the time.
If not you must use the time in the search criteria
Al Campagna wrote:
[Quoted Text]
> Clarkey,
> Sounds like your Date and Time (which really couls be done with
> just a Now()) is just a calculated field.
> Also, it sounds as though you're trying to capture the Date and
> Time the new record is created.
>
> Add a field to your table behind the form, and call it DOC
> (DateofCreation), and use that field as the ControlSource of the text
> control on your form.
> Make the Default Value...
> = Now()
> Every time a new record is created, the Date and Time will be
> captured to the DOC field.
>
> "Clarkey" <Clarkey[ at ]discussions.microsoft.com> wrote in message
> news:AC2329E9-7E1D-4518-9F98-BE2611CC8668[ at ]microsoft.com...
>> Hi there,
>>
>> Wondering if someone could assist with some difficulty I'm having
>> with saving the date and time from a form into a table.
>>
>> I have a form which displays the Date() and Time() in a text box
>> using the Control Source property. When the form is opened it
>> automatically inserts this data. I cant quite work out how to then
>> save the data from these fields
>> into the table, as the Control Source is what usually links this to
>> the table.
>>
>> Any solutions?


Re: Saving the date & time from a form
John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 12/11/2008 6:12:30 AM
On Wed, 10 Dec 2008 21:02:02 -0800, "Mike Painter"
<mddotpainter[ at ]sbcglobal.net> wrote:

[Quoted Text]
>There is a problem with using Now() if you wish to do a between search on a
>date range.
>I'd keep Date() and maybe use Now() for just the time.
>If not you must use the time in the search criteria

Or use a range, as is perfectly standard in many databases:

>= [Enter date:] AND < DateAdd("d", 1, [Enter date:])

In other words if you need the date and time, store both in one field. It's
easy to search for them with a bit of care.
--

John W. Vinson [MVP]

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net