We help IT Professionals succeed at work.

Passing a reference to a function on the 'current' record in a recordset

scbdpm
scbdpm asked
on
208 Views
Last Modified: 2010-04-30
My app is using a module level recordset.

I am looping through each of the records in this recordset.
With each one, I call a function that will do 'something' with the information in each record.

how can I pass a reference to the 'current' record in the recordset to the function?

Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
if the recordset is defined on module level, and the function also, you might consider using no parameter at all.
however, you should pass the recordset variable, it will be on the correct place if you loop in the calling code with the .MoveNext ...

Author

Commented:
angelIII:

How do I do what you suggest: "however, you should pass the recordset variable, it will be on the correct place if you loop in the calling code with the .MoveNext ..."
Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I've adapted your code to my app.

However, I am getting a 'Type Mismatch' error on the line : YourJob r
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
that is only possible if you omitted, in either places the "adodb." from the "adodb.recordset"

Author

Commented:
Actually I had:

YourJob (r)


instead of:
YourJob r
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
glad you found that difference.
do you actually know that the () made as difference?

if not, they will actually make that not     r   is  passed, but the default property of r

Author

Commented:
once I removed the (), it ran like clockwork.....

thoughts?
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
see my comment above
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.