Rename Tbl before Import

  • Thread starter Thread starter Bonnie
  • Start date Start date
B

Bonnie

Hi there. Using A02 on XP. Have a form with buttons for
importing data, manipulating it and exporting it. How can
I change the name of an existing table (including a
parameter inquiry for the new name)? I have a
table 'PayPerData' that receives new imported data. Before
the new import, I'd like to rename the existing PayPerData
tbl to the actual pay period date (for ex. 04302004) and
then import the next pay period's data, thus keeping a
running set of tables with each pay period's info.

Should this be done in a macro or in the button's OnClick
event? I'm guessing event procedure but not sure of the
command language.

Thanks in advance for any help or advice!!!
 
CurrentDb().TableDefs("PayPerData").Name = "PayPerData" & Format$(Date,
"mmddyyyy")

I can't remember whether you need a reference to DAO to make this work in
Access 2000 and 2002.
 
Hi there and thanks for the info. Placed wordage on a form
button's OnClick Event but getting Runtime Error 3265 -
Item not found in this collection. Mine reads:

CurrentDb().TableDefs("AmerHlthPayPeriodData").Name
= "AmerHlthPayPeriodData" & Format$(Date, "mmddyy")

I checked my references and DAO 3.6 is in my Tools,
References list. Do I have to put any additional wordage
in my code? Also, how would I put a parameter to ask what
date? Insert [What date?] where Date is?

Thanks for any additional help or advice you can provide!
 
Back
Top