Make Table action

G

Guest

I am using the code below to make a new table named with the date and
"Batch". In my sql string it ignores the variable and just names the table
"tmpBatch".

Is there a way to use the variable as the new table name?


tmpBatch = Format(Date, "yyyymmdd")
tmpBatch = tmpBatch & " Batch"
'Makes temp table to store last batch
sql = "SELECT [MOVEX BATCH FILE].* INTO tmpBatch from [MOVEX BATCH FILE]"

DoCmd.RunSQL sql

Thank you.

Cindy
 
J

John Spencer

sql = "SELECT [MOVEX BATCH FILE].* INTO [" & tmpBatch & "] FROM [MOVEX
BATCH FILE]"
 
G

Guest

Thank you John.

Is there also a way to shown the number of records in the table that was
created? Do I need to open the record set and get the count?

John Spencer said:
sql = "SELECT [MOVEX BATCH FILE].* INTO [" & tmpBatch & "] FROM [MOVEX
BATCH FILE]"

CindyK said:
I am using the code below to make a new table named with the date and
"Batch". In my sql string it ignores the variable and just names the
table
"tmpBatch".

Is there a way to use the variable as the new table name?


tmpBatch = Format(Date, "yyyymmdd")
tmpBatch = tmpBatch & " Batch"
'Makes temp table to store last batch
sql = "SELECT [MOVEX BATCH FILE].* INTO tmpBatch from [MOVEX BATCH FILE]"

DoCmd.RunSQL sql

Thank you.

Cindy
 
J

John Spencer

I'm not sure it will work, but try the recordsaffected property of the
database object.
Currentdb().RecordsAffected


CindyK said:
Thank you John.

Is there also a way to shown the number of records in the table that was
created? Do I need to open the record set and get the count?

John Spencer said:
sql = "SELECT [MOVEX BATCH FILE].* INTO [" & tmpBatch & "] FROM [MOVEX
BATCH FILE]"

CindyK said:
I am using the code below to make a new table named with the date and
"Batch". In my sql string it ignores the variable and just names the
table
"tmpBatch".

Is there a way to use the variable as the new table name?


tmpBatch = Format(Date, "yyyymmdd")
tmpBatch = tmpBatch & " Batch"
'Makes temp table to store last batch
sql = "SELECT [MOVEX BATCH FILE].* INTO tmpBatch from [MOVEX BATCH
FILE]"

DoCmd.RunSQL sql

Thank you.

Cindy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top