Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append Query

Status
Not open for further replies.

sha123

Programmer
Nov 13, 2002
58
0
0
ZA
I have a table called Orders with 3 Day fields called:

1)Day1 2)Day2 3)Day3.

I now need to create a append query to copy these days into one field in a new table, but I now need it to ask which days need to be copied into the new combined field called combined.

How will I do this?

 
This requires two queries:

Save this SQL as qryDayValueSelect:
Code:
SELECT Switch([Which Day?: "]=1,[tblDays]![Day1],[Which Day?: "]=2,[tblDays]![Day2],[Which Day?: "]=3,[tblDays]![Day3]) AS SelectDay
FROM tblDays;

Save this SQL as qryAppDayValues:
Code:
INSERT INTO tblNewDays ( DayValue )
SELECT qryDayValueSelect.[SelectDay]
FROM qryDayValueSelect;

Now just run the query qryAppDayValues to append the values from the selected field from tblDays to the new table tblNewDays. You will have to create the new table first with a field named DayValue(numeric-Long). This second second query could be a make-table query where a new table would be created each time your run it. It would delete the old query and create a new one based upon the day value selected.

Post back and let me know if this is what you need.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top