Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions
This is the forum to discuss the Wrox book VBScript Programmer's Reference, 3rd Edition by Adrian Kingsley-Hughes, Kathie Kingsley-Hughes, Daniel Read; ISBN: 9780470168080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 4th, 2004, 09:13 AM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to hadeniyi
Default looping through access table.

Q: I'm trying to loop through an access table while comparing field value to one another testing if they are in sequence order. If test sequence is is not true then add on to the previouse field value and assign it to a text box. below is the code; Can anyone convey as to why I recieve this error message:Item not found in this collection. (Error 3265)

An attempt to reference a name in a collection failed.
Possible causes:


  Set rstD = CurrentDb.OpenRecordset("SELECT ACCOUNT FROM [20XXXX1]", dbOpenDynaset)
   Set rstD2 = CurrentDb.OpenRecordset("SELECT ACCOUNT FROM [20XXXX1]", dbOpenDynaset)

rstD.MoveFirst
rstD2.MoveFirst



For i = 0 To rstD.RecordCount + 1

  For j = 0 To rstD.RecordCount + 2

      If rstD.Fields(j).Value - rstD.Fields(i).Value > 1 Then
            ACCOUNT.Value = Val(rstD.Fields(i).Value) + 1
          Exit Sub
      End If
       rstD.MoveNext
      Next j
    rstD2.MoveNext
 Next i

rstD.Close
rstD2.Close
Set rstD = Nothing




Reply With Quote
  #2 (permalink)  
Old April 18th, 2006, 01:27 AM
Registered User
 
Join Date: Apr 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi hadenyiyi,

rstD.MoveFirst
rstD2.MoveFirst
This code above is not needed since the recordset will automatically in the first location.


rstD.RecordCount
This code is used to count how many rows of record you have inside rstd.

rstD.Fields(j).Value
This code is used to referencing (j-1)th column at certain row.

I guess your code get error since you accessing the column that may not available.

But I don't get what is your code going to do??
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Photo in Access table mateenmohd Access 2 November 2nd, 2007 08:48 AM
3D Array Looping - Formatting in table jordan23 XSLT 3 April 30th, 2007 11:57 AM
looping through a table John Parker Access VBA 7 December 11th, 2006 07:30 PM
access table keyvanjan ASP.NET 1.0 and 1.1 Basics 2 January 24th, 2006 03:22 PM
Update an access table Rash4u Classic ASP Databases 2 February 3rd, 2005 04:24 PM



All times are GMT -4. The time now is 09:06 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.