creating a ADODB Recordset and adding records... (1 Viewer)

zozew

Registered User.
Local time
Tomorrow, 05:36
Joined
Nov 18, 2010
Messages
199
Well they have the same name, and yes i have tried renaming them differently with no success, and yes i did try the set keyword...so im at a lost but ill keep debugging

thanks again

Zozew
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 07:36
Joined
Jan 20, 2009
Messages
12,853
You have the recordset Open line commented out in your posted code. The recordset must be open when it is set as the recordset of the form. I imagine you have tried both ways though.

I suspect this may be the problem. If the VBA breaks, when you End execution all the variables are lost. This would cause the Error 91 (With Block variable not set). The missing variable may be causing trouble when you rerun your test even though you might actually have the code right at the time.

After the code stops, you would need to reopen the form to reinstantiate the variables in the declarations section.
 

zozew

Registered User.
Local time
Tomorrow, 05:36
Joined
Nov 18, 2010
Messages
199
I think you missed the line:

Code:
etalsDisplayRecordSet.Open , , adOpenDynamic, adLockOptimistic
Up in the code where its open..i actually never close it.....

* ill do some more debugging

But the problem doesn't seem to be with the recordset(it gets populated and so on)....its referring to the form in the mainform.....you mean to say that if its not open i get the error 91..?
 

CBrighton

Surfing while working...
Local time
Today, 22:36
Joined
Nov 9, 2010
Messages
1,012
The limit is 24 continuations. In 2007 the VBA Editor gives a warning when limit this is reached on entry without having to wait for compilation.
I don't have 2007. The limit is there so I have the options of coding different length string different ways or keeping it all the same throughout my code.

Moreover, without the wasted space used in double repetition of the variable name on every line, it is often quite practical to list several fields on each line. It is rare to have more than 24 fields in a query anyway.
Again, I see it as a bonus for readability that you only have to scan in one direction to see what fields are used. I only have to look down the list, not read it like a book.
I will accept that if you leave out "readability" because all the clutter in the iterative concatenation certainly does not enhance readability.

Look at your code. Then look at mine in the same way, but move your eyes to the right about 2 inches.

Now they read exactly the same.

I agree that at a glance mine looks more "busy". However when actually reading it there is little to no difference as you simply don't read the first bit (just as you don't read the whitespace in your method).

However, this is well off topic and I'll leave it now. Especially as I don't know about the Recordset code in the actual thread so all I'm doing is filling it up with rubbish!
 

Users who are viewing this thread

Top Bottom