Dynamic change of SQL string based on valeu on form

G

Guest

I use 6 variations of the following SQL to select values from 6 different
columns of a reference table.

SELECT nz([Forms]![Tabulate]![Score ID]) AS [Score ID], [Penalty
Names].[Penalty ID], [Penalty Names].[fldA] AS [Sort Key]
FROM [Penalty Names]
WHERE ((([Penalty Names].[fldA])=True));

One version of the query looks in "fldA" another looks in "FldB" etc...

How can I code this so that I only have one version and use the contents of
a field on a form determine if the query looks in fldA or fldB or ...

Say the Form is frm1 and the TextBox is tb2
 
G

Guest

A work around is to build 6 WHERE statements that are OR'd and are AND'd with
checkboxes or option group on your form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top