OpenRecordset(queryName) refering to form

F

Fjordur

Hi,
I have the following code
Public Function f(strSql As String, ...
...
r= CurrentDb.OpenRecordset(strSql)
I call f with the name of queries as arguments.

Calling function f with the name of a query works only when the query
doesn't include a where clause referring to an open form
(
.field=[Forms]![form]![control]).
Is there a way I can refer to the form in the query, so that I can use my
function f with only the name of the query as an argument? BTW some of the
queries have such a where clause, others don't.
This is rather crucial to the project, and I hope there's a way I can
circumvent this (hopefully a shortcoming of mine regarding SQL-VB syntax)
Thanx, all
 
D

Duncan Bachen

Fjordur said:
Hi,
I have the following code
Public Function f(strSql As String, ...
...
r= CurrentDb.OpenRecordset(strSql)
I call f with the name of queries as arguments.

Calling function f with the name of a query works only when the query
doesn't include a where clause referring to an open form
(
.field=[Forms]![form]![control]).
Is there a way I can refer to the form in the query, so that I can use my
function f with only the name of the query as an argument? BTW some of the
queries have such a where clause, others don't.
This is rather crucial to the project, and I hope there's a way I can
circumvent this (hopefully a shortcoming of mine regarding SQL-VB syntax)
Thanx, all


I didn't realize that you had already reposted this question in another
thread. I'm going to kill this discussion and let the other one continue.
 
Top