Re: Need help creating temporary table from filter
- From: "tina" <nospam@xxxxxxxxxxx>
- Date: Sun, 12 Feb 2006 20:35:10 GMT
to make a table, just run the SQL statement, as
CurrentDb.Execute strSQLMakeTable, dbFailOnError
btw, if you're creating the table repeatedly, then you must be deleting the
table as well, correct? it might be more efficient to simply create the
table once, and then use code to run a Delete query and Append query to
empty the table of records and add a new set of records, as needed. keep in
mind that either option will cause the database to bloat, so you should
compact/repair it regularly. also, consider *why* you're putting records
into a separate table as a subset of existing data; if you can accomplish
what you need to do by basing your process on the SELECT query, then dumping
the data into a separate table is probably a waste of time.
hth
"Darhl Thomason" <darhlt@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:e1x0OHBMGHA.2012@xxxxxxxxxxxxxxxxxxxxxxx
I want to build a temporary table based on a filter in my code. I usedthe
query designer to build the query and when I run it from there, it buildsI
the table fine.
The problem is getting it in to my code. I want to build the table when I
click a button so I can use that for another process. Right now I'm just
trying to get the table to build. I've read the help files in Access but
know I am missing something. The code I'm using is below, I just needsome
direction in actually getting it to create the table. I tried using the"
DoCmd.OpenTable, and think that's what I want to do, but just can't get it
to work.
Thanks!
Darhl
Private Sub cmdMakeTable_Click()
strSQLMakeTable = "SELECT tblStoreData.Number, tblStoreData.City,
tblStoreData.OpenDate, " & _
"tblDistrict.DomName, tblDistrict.DomEmail, tblFC.*,
tblOwners.* " & _
"INTO tblTemp " & _
"FROM tblRegion INNER JOIN (tblOwners " & _
"INNER JOIN (tblFC " & _
"INNER JOIN ((tblDistrict " & _
"INNER JOIN tblStoreData " & _
"ON tblDistrict.DistrictID = tblStoreData.DistrictID)
& _tblDMA.DMAID)
"INNER JOIN tblDMA ON tblStoreData.DMAID =
" & __
"ON tblFC.FCID = tblStoreData.FCID) " & _
"ON tblOwners.OwnerID = tblStoreData.OwnerID) " & _
"ON (tblRegion.RegionID = tblDistrict.RegionID) " & _
"AND (tblRegion.RegionID = tblStoreData.RegionID) " &
"WHERE " & strFilter
' DoCmd.OpenTable "tblTemp", acViewDesign, acAdd = strSQLMakeTable
End Sub
.
- Follow-Ups:
- Re: Need help creating temporary table from filter
- From: Darhl Thomason
- Re: Need help creating temporary table from filter
- References:
- Need help creating temporary table from filter
- From: Darhl Thomason
- Need help creating temporary table from filter
- Prev by Date: Re: Code wont work in ADP
- Next by Date: Re: Copy text from Text box to text box
- Previous by thread: Need help creating temporary table from filter
- Next by thread: Re: Need help creating temporary table from filter
- Index(es):