Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Access data change

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,38354
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Access data change
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Access data change - 10/4/2006 11:46:45 AM   
  djfitzie

 

Posts: 7
Score: 0
Joined: 10/4/2006
Status: offline
Hi,

I am new to the forum and have only been working with vbscript for a short period. I am trying to change data in one column of an access table depending on it meeting the criteria from another column.

The code i am using is listed below. I am having a problem in that it updates the first entry and then the script runs using 100% cpu until I cancel it.

On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objConnection.Open _
   "Provider = Microsoft.Jet.OLEDB.4.0; " & _
       "Data Source = C:\Program Files\Free Scan\DATA\InctDat.mdb"
objRecordSet.Open "SELECT * FROM tblConsolidatedSales" , _
   objConnection, adOpenStatic, adLockOptimistic
Set dtmStartDate = CreateObject("WbemScripting.SWbemDateTime")

strCriteria = "TRDate <= dtmStartDate"
Do Until objRecordSet.EOF
objRecordSet.Find strCriteria
objRecordset.Fields.Item("ReceiptDate") = "16/08/2006 4:04:18 AM"
objRecordset.Update
Loop
objRecordSet.Close
objConnection.Close


Any assistance with this would be greatly appreciated.

Regards David
 
 
Post #: 1
 
 RE: Access data change - 10/5/2006 3:29:57 PM   
  djfitzie

 

Posts: 7
Score: 0
Joined: 10/4/2006
Status: offline
The problems is the missing objRecordset.movenext before the loop.

Thanks

(in reply to djfitzie)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Access data change Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts