|
-
Mar 14th, 2000, 02:54 AM
#1
Thread Starter
New Member
I want to programatically loop through all the rows in my database when a user clicks on a pushbutton.
However I get an error:
"Object variable or with block variable not set"
Here's what I am doing:
do while not adoTargets.recordset.eof
...
... processing code here
...
loop
What am I doing wrong ? I want it to loop until EOF.
-
Mar 14th, 2000, 03:01 AM
#2
Frenzied Member
Have you definately gone adoTargets.recordset.movefirst before the loop and make sure your recordset object is attatched to a database recordset, I still use DAO myself so i'm not sure.
Hope this helps
-
Mar 14th, 2000, 03:36 AM
#3
Thread Starter
New Member
Here's what my code looks like now:
--------------------------------------------
adoTargets.recordset.movefirst
do while not adoTargets.recordset.EOF
...
... Processing code here
...
loop
--------------------------------------------
I am now getting an error on the first stmt:
adoTargets.recordset.movefirst
I get the same error:
"Object variable or with block not set"
Hummmm.... suggestions ? anyone please??
-
Mar 14th, 2000, 03:47 AM
#4
Hyperactive Member
Did you set the recordset anywhere? You have to set adoTargets to something. I'm not sure how it works with ADO exactly (whether you're using a physical control) but
set adoTarget = dbDatabase.OpenRecordset(Table)
might work with Table being the name of your table and dbDatabase being your database. If it's a physical control - you need to do this:
adoTarget.Recordsource = "Select * from table"
or something like that.
-
Mar 14th, 2000, 03:54 AM
#5
Thread Starter
New Member
Within the ADO data control I set the recordsource to:
SELECT * from Targets
(I have double checked to be sure that the table name is spelled correctly.)
-
Jul 8th, 2005, 12:18 AM
#6
New Member
Re: Do...Loop Question
Chk 4 ur connection, ur recordset is not opening at all
Thanx & Regards,
Suresh Mishra
-
Jul 8th, 2005, 12:19 AM
#7
Re: Do...Loop Question
Did you know the date of that thread?
-
Jul 8th, 2005, 09:17 AM
#8
New Member
Re: Do...Loop Question
Yes I did but then I also didn't C the satisfactory reply 2 last post n I thought that my post might help in future if required. If the prob is already solved I think this post should not hav come. I'd advice stop pointing out this kind of logical things like kids.
Thanx
Thanx & Regards,
Suresh Mishra
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|