View Single Post
  #1   Report Post  
AaronC
 
Posts: n/a
Default Using form control names in SQL


I am creating a query that retrieves data from one table and creates a
second table. I want to name the columns in the new table using the
contents of the controls from a form within the same mdb. The form will
be open when this query is run, but I am having trouble creating and
saving the query.

Here is a sample of what I am trying to do...Any help is greatly
appreciated!!

Thanks

SELECT IndividualHolidays.SU, IndividualHolidays.SSN,
IndividualHolidays.Init, IndividualHolidays.LName,
Max(IndividualHolidays.NewYearsDay) AS
Forms!HolidayDatesEntry!NewYearsDay,
Max(IndividualHolidays.AftNewYears) AS
Forms!HolidayDatesEntry!AftNewYears,
Max(IndividualHolidays.PresDay) AS Forms!HolidayDatesEntry!PresDay,
Max(IndividualHolidays.AftPresDay) AS
Forms!HolidayDatesEntry!AftPresDay
…<etc
INTO HolidaysByEmp
FROM IndividualHolidays
GROUP BY IndividualHolidays.SU, IndividualHolidays.SSN,
IndividualHolidays.Init, IndividualHolidays.LName;


--
AaronC
------------------------------------------------------------------------
AaronC's Profile: http://www.excelforum.com/member.php...o&userid=21240
View this thread: http://www.excelforum.com/showthread...hreadid=387226