Hello...
I have a form named: Reports
On this form there is a text box named: Comment_Search
Contents of the text box is: Water_Comments
The contents of the text box are actual column names in a table.
I am trying, without success, to create a query which will use the text box data as the column name in the SQL Select statement.
Here is an example of what I am trying to do.
SELECT Report_Date, [Forms]![frm_reports]![Comment_Search] AS Display_Data FROM Daily_Data;
SELECT Report_Date, ([Forms]![frm_reports]![Comment_Search]) AS Display_Data FROM Daily_Data;
SELECT Report_Date, ([Forms]![frm_reports]![Comment_Search].value) AS Display_Data FROM Daily_Data;
SELECT Report_Date, ([Forms]![frm_reports]![Comment_Search]![value]) AS Display_Data FROM Daily_Data;
If I use this example, with the column name hard coded, the query works as desired.
SELECT Report_Date, Water_Comments AS Display_Data FROM Daily_Data;
Thank you greatly for your time, assistance and help.
I have a form named: Reports
On this form there is a text box named: Comment_Search
Contents of the text box is: Water_Comments
The contents of the text box are actual column names in a table.
I am trying, without success, to create a query which will use the text box data as the column name in the SQL Select statement.
Here is an example of what I am trying to do.
SELECT Report_Date, [Forms]![frm_reports]![Comment_Search] AS Display_Data FROM Daily_Data;
SELECT Report_Date, ([Forms]![frm_reports]![Comment_Search]) AS Display_Data FROM Daily_Data;
SELECT Report_Date, ([Forms]![frm_reports]![Comment_Search].value) AS Display_Data FROM Daily_Data;
SELECT Report_Date, ([Forms]![frm_reports]![Comment_Search]![value]) AS Display_Data FROM Daily_Data;
If I use this example, with the column name hard coded, the query works as desired.
SELECT Report_Date, Water_Comments AS Display_Data FROM Daily_Data;
Thank you greatly for your time, assistance and help.