By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,153 Members | 2,581 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,153 IT Pros & Developers. It's quick & easy.

public recordset

P: n/a
I have form code that declares a public recordset at the top:

Public pubRS As DAO.Recordset

I open a recordset and assign it:

Set pubRS = rsSelect

(printing current record from pubRS works here)

I then call a public subroutine in a module and attempt to print the
current record:

Debug.Print "123---" & pubRS("TG_CNTRCT_ID")

and I get:

" Compile Error: Sub or Function not defined. "

What did I do wrong?



Aug 13 '07 #1
Share this Question
Share on Google+
1 Reply

P: n/a
ok, I passed the recordset in as a parameter.

I'm doing something a little non-standard:

varReplaceWith = Eval(snpReplaceCodes!ReplaceWith)

I do an Eval from a recordet where:

snpReplaceCodes!ReplaceWith = passedRS!FieldName

so in effect:

varReplaceWith = Eval(passedRS!FieldName)

Stepping through the code, as soon as it hits the eval on that
recordset, it returns from the subroutine (prematurely).

I usually use this code with forms, so in effect:

varReplaceWith = Eval(Forms!FormName!FieldName)

consistently works.

Why won't this work on a recordset without being tied to a form?

Aug 13 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.