p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Entering a date into a database


Message #1 by "Timothy Hopkins" <hopkin11@m...> on Thu, 6 Jul 2000 21:31:32 -0500
I have a form people fill out.  When they click submit, the information goes

into an Access database and a page is displayed showing them the info they

submitted.

What I would like to do is when the form is submitted, the date the form is

submitted is sent to the database, too.  But I would rather not have them

fill in the date (it is sometimes advantageous to them to enter a date

earlier than the real one).

I tried using a hidden field in the form, and setting the field value to

<%=date%> but, of course, the date didn't get entered into the database,

only the little piece of script.  Does anyone know how I could get this to

work?  Thanks.

Message #2 by "Dana Coffey" <dcoffey@x...> on Fri, 7 Jul 2000 06:42:07 -0700
Couldn't you just omit the date on the form and insert it into the record

set using the code?  ie.  objRec("activedate") = date        ???



dc



Dana Coffey

Technologist, Xceed, Inc.

112 Krog St.  Atlanta, GA  30307

tel.  xxx-xxx-xxxx  x 5013

www.xceed.com



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Everything should be as simple as it is, but not simpler.

----Albert Einstein

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~







-----Original Message-----

From: Timothy Hopkins 

Sent: Thursday, July 06, 2000 7:32 PM

To: ASP Databases

Subject: [asp_databases] Entering a date into a database





I have a form people fill out.  When they click submit, the information goes

into an Access database and a page is displayed showing them the info they

submitted.

What I would like to do is when the form is submitted, the date the form is

submitted is sent to the database, too.  But I would rather not have them

fill in the date (it is sometimes advantageous to them to enter a date

earlier than the real one).

I tried using a hidden field in the form, and setting the field value to

<%=date%> but, of course, the date didn't get entered into the database,

only the little piece of script.  Does anyone know how I could get this to

work?  Thanks.



Message #3 by "Bob Lewis" <lewisbd@y...> on Wed, 12 Jul 2000 09:10:29 -0400
Tim,



If I understand correctly what you are trying to do, you can accomplish it

by simply set up a field in your Access database, view it in Design View,

click on the field, and in insert the function Now() in the "Default Value"

properties field.  This will automatically insert into the field the date

and time the record was created. You can then use your script to format the

output, should you wish to display that information to the user.



Bob Lewis

lewisbd@y...

www.solidrockmissions.org



-----Original Message-----

From: Timothy Hopkins 

Sent: Thursday, July 06, 2000 10:32 PM

To: ASP Databases

Subject: [asp_databases] Entering a date into a database





I have a form people fill out.  When they click submit, the information goes

into an Access database and a page is displayed showing them the info they

submitted.

What I would like to do is when the form is submitted, the date the form is

submitted is sent to the database, too.  But I would rather not have them

fill in the date (it is sometimes advantageous to them to enter a date

earlier than the real one).

I tried using a hidden field in the form, and setting the field value to

<%=date%> but, of course, the date didn't get entered into the database,

only the little piece of script.  Does anyone know how I could get this to

work?  Thanks.




  Return to Index