M
matt donker via AccessMonster.com
Now i have posted this same entry about 3 different ways now and got no
response begining to think that this site is useless. What i am trying to
do is use the Run Sql command from vb to run a make table query which takes
all fields from the table toolingtracker that datepart m of date = a
variable i have previously stored made as monthnum and puts the information
into a table called tooling archives or something.
Then i want use the docm.output object to output the table and then delete
the table i make. This code works for my inventory table but when i try to
the same using the tooling table i get an error message 3211 table locked
by another person or process. Nobody else is using the table and the vb
code is on the first form so nothing else is even using the table.
If someone could please help me out here it would be much appreciated this
is the third time i have posted and no one has responded so if you guys
don't know could you reccomend a better forum as i really need an answer.
Is there a better way to do this?
Here is the code:
DoCmd.SetWarnings False
Dim strOutputSQLT As String
strOutputSQLT = "SELECT * INTO tblToolingArchive" _
& " FROM [tblToolingTracker]" _
& " WHERE DatePart ('m', [Date]) =" & MonthNum
DoCmd.RunSQL strOutputSQLT
'Output the table to an excel file
DoCmd.OutputTo acOutputTable, "tblToolingArchive",
acFormatXLS, "\\tor-file-01\BusinessImprovement\AssemblySummer\mto08428\
Computer Inventory Database- Active\ToolingArchives\" & MonthName & YearNum
'Delete Table
DoCmd.DeleteObject acTable, "tblToolingArchive"
CurrentDb.TableDefs.Refresh
response begining to think that this site is useless. What i am trying to
do is use the Run Sql command from vb to run a make table query which takes
all fields from the table toolingtracker that datepart m of date = a
variable i have previously stored made as monthnum and puts the information
into a table called tooling archives or something.
Then i want use the docm.output object to output the table and then delete
the table i make. This code works for my inventory table but when i try to
the same using the tooling table i get an error message 3211 table locked
by another person or process. Nobody else is using the table and the vb
code is on the first form so nothing else is even using the table.
If someone could please help me out here it would be much appreciated this
is the third time i have posted and no one has responded so if you guys
don't know could you reccomend a better forum as i really need an answer.
Is there a better way to do this?
Here is the code:
DoCmd.SetWarnings False
Dim strOutputSQLT As String
strOutputSQLT = "SELECT * INTO tblToolingArchive" _
& " FROM [tblToolingTracker]" _
& " WHERE DatePart ('m', [Date]) =" & MonthNum
DoCmd.RunSQL strOutputSQLT
'Output the table to an excel file
DoCmd.OutputTo acOutputTable, "tblToolingArchive",
acFormatXLS, "\\tor-file-01\BusinessImprovement\AssemblySummer\mto08428\
Computer Inventory Database- Active\ToolingArchives\" & MonthName & YearNum
'Delete Table
DoCmd.DeleteObject acTable, "tblToolingArchive"
CurrentDb.TableDefs.Refresh