rs.fields(1) start line set to loop from 2001th line

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Claudiu
Posts: 32
Joined: Fri Aug 07, 2009 10:16 am

rs.fields(1) start line set to loop from 2001th line

Post by Claudiu » Sat Dec 11, 2010 2:17 pm

hi,

i'm using the database 2 web method and i'd like tho to be able to set a starting line for the rs.fields(1)
so, when the script starts, i need the rs.fields(1) to loop from line 2001 to any number

i tried the cmd line
for i = 2001 to 4000

it doesn't seem to be helping as it starts from line 1

i'd appreciate some thoughts on this ...

my current script is

Code: Select all

do While not iret < 0 

iret = iim1.iimSet("name", rs.fields(1))
iret = iim1.iimPlay(macro1)

 if (htmlfield = 5) then
  iret = iim1.iimPlay(macro2)
 end if

loop

Tom, Tech Support
Posts: 3604
Joined: Mon May 31, 2010 4:59 pm

Re: rs.fields(1) start line set to loop from 2001th line

Post by Tom, Tech Support » Mon Dec 13, 2010 4:34 pm

Hi Claudiu,

The database-2-web example uses ActiveX Database Objects (ADO) to connect to and query an Access database table. The most efficient way of selecting a subset of the records is to use a SQL query. The default query in the example is simply "select * from table1", which retrieves all of the records in no particular order. If your table has an index or other appropriate column you can use to uniquely identify each record, then you should include this in your query (e.g. "SELECT * FROM table1 WHERE id > 2000 and id <= 4000").

If you don't have such an index or identifier column, then you will need to sequentially move the recordset pointer to the desired row in the table using the rs.MoveNext method:

Code: Select all

For i = 1 To 2000
    rs.MoveNext
Next

' Current record is now 2001 after the loop above
Regards,

Tom, iMacros Support
Claudiu
Posts: 32
Joined: Fri Aug 07, 2009 10:16 am

Re: rs.fields(1) start line set to loop from 2001th line

Post by Claudiu » Tue Dec 14, 2010 5:44 pm

ty .. works flawless .. all i needed was the "where id > 2000 and id < 4000"
Post Reply