Programmatically determinae the field name referenced by query par

I

ImJoe

The following example may further clarify the question,
Select fieldA, filedB, fieldC
From tblX
Where fieldD = Forms!formName!controlName

What I'd like to know is how to determine or get (FieldD) for the above SQL
stmt, which is a saved query. Meantime, let me stress, I'm talking about
query param(s), not criteria, an example of criteria is as follows:
Select fieldA, filedB
From tblY
Where fieldC = 'thisValue'

How?

TIA.
 
A

Allen Browne

Access (JET) does not expose this to you, so you will need to write code to
parse the query statement and determine which are keywords, which are table
names, fields names, table aliases, field aliases, literals, and then which
names do not match any of the above.

Anything that does not resolve to another name, Access treats as a
parameter.

If this is your own database, you could simplify your job (and improve the
reliability of the query) by declaring the parameters. In query design view,
choose Parameters on the Query menu, and enter something like:
Forms!formName!controlName Long
Then you only have to parse the first clause of the query, and you could use
Split() if there are multiple entries in the PARAMETERS clause.
 
Top