Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 10th, 2004, 04:52 AM
Authorized User
 
Join Date: Sep 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Add Datetime to Recordset

Hello all,
I got difficulty to add current datetime in following recordset. I know it should not be Now() which works in non ADODB way. I believed it is a very difficult one so can you please me a help.

    Do Until rst1.EOF
        rst1.Fields("cutoff_dt").Value = Now()
        rst1.Update
        rst1.MoveNext
    Loop

Thanks and Best Regards,
martinaccess :D:D:D

 
Old October 10th, 2004, 05:46 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Personally I would use SQL:
Code:
Dim dt as date
dt = Now()
Dim sDate as string
sDate = Format(dt, <format here>)
"UPDATE tblWhatever Set cutoff_dt = #" & sDate & "#"
but your technique should work as long as the recordset is updateable.
What exactly is happening?

--

Joe

--

Joe (Co-author Beginning XML, 3rd edition)
 
Old October 10th, 2004, 07:30 AM
Authorized User
 
Join Date: Sep 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Joe,

Thanks very much. I have attempted again but this time to add one more line to requery the form again. It works now and I think it is the cause of problem.

Once again, thanks for your help.

Have a good day!
martin access:D:D:D






Similar Threads
Thread Thread Starter Forum Replies Last Post
add new record to ADO recordset via stored proc tbullard Access 0 January 20th, 2006 02:35 PM
ADODB.Recordset (0x800A0CB3)Current Recordset does tks_muthu Classic ASP Databases 0 June 16th, 2005 07:22 AM
UTC DateTime to Local DateTime r_ganesh76 SQL Server 2000 1 April 4th, 2005 08:21 AM
how to add new column to recordset?? huela Access VBA 0 October 13th, 2004 01:22 PM
Add field to top of recordset vertigo Beginning VB 6 6 July 14th, 2004 03:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.