attach parameter to table name

lovedieer

Registered User.
Local time
Today, 11:11
Joined
Nov 4, 2009
Messages
28
I am trying to set up a create table query using parameter called Year. For each year I input , I need to create a new table with the suffix of the year. for example, if i input year 2011, i want to create a table called budget_2011, if i input year 2012, i want to create a table called budget-2012...
Any idea?
 
I am trying to set up a create table query using parameter called Year. For each year I input , I need to create a new table with the suffix of the year. for example, if i input year 2011, i want to create a table called budget_2011, if i input year 2012, i want to create a table called budget-2012...
Any idea?
I don't think you can that so, I think you've to use some VBA-code like below.
Code:
  CurrentDb.Execute ("Select Null As AField into MyTable_" & InputBox("Input year"))
 
thank you for the post.
 
I am trying to set up a create table query using parameter called Year. For each year I input , I need to create a new table with the suffix of the year. for example, if i input year 2011, i want to create a table called budget_2011, if i input year 2012, i want to create a table called budget-2012...
Any idea?

That is not a normalized database. Do not create separate tables to hold identical data structures.

You should have a single table with a field to indicate the relevant year of the records. Append the records to the table and pass the parameter as the value to be store in the year field.

Queries to the table for each year simply select on the year field. If you hold them in separate tables you will need to create a different set of queries for each year and keep creating them every new year.

BTW. Don't call the field Year because this is a reserved word, the name of a function.
 

Users who are viewing this thread

Back
Top Bottom