Wrox Programmer Forums
| 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 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
  #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




  #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??


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





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