Assign a column variable in SQL - TechRepublic
General discussion
January 26, 2003 at 01:43 AM
richtee

Assign a column variable in SQL

by richtee . Updated 23 years, 5 months ago

Using Access2K. — Need help with writing the following SQL statement which is Making a table based on another query. The first query has many columns and I only want to make the new table with a one specifically selected column.

SELECT [qry_#2_DeptTotals_GROUP_Plan].Major_Account_Group, [qry_#2_DeptTotals_GROUP_Plan].CC_ID, [qry_#2_DeptTotals_GROUP_Plan].Nov_Tot INTO tblCostCtrMonthbyGroup
FROM [qry_#2_DeptTotals_GROUP_Plan];

The SQL statement will reside on a form and will launch (DoCmd.RunSQL) from a command button

The column to be returned for the new table will be the value from a Text box control that is on the form.

I want to replace the following in the above statement:

[qry_#2_DeptTotals_GROUP_Plan].Nov_Tot

with a variable that gets its value from a Text Box control on the form.

Thanks,
Rich

This discussion is locked

All Comments