Put query into new database



I have an ad hoc tool that i have built for our sales people. I creates a
new access database and puts the data they requested into 4 tables. Here's
the code I use to create the database and to create one of the tables

' This section Creates the database.
' It will delete the file if it already exists.

Dim wrkDefault As Workspace
Dim dbsNew As Database
Dim prpLoop As Property


' Get default Workspace.
Set wrkDefault = DBEngine.Workspaces(0)

' Make sure there isn't already a file with the name of
' the new database.
If Dir(AccessFilePath) <> "" Then Kill AccessFilePath

' Create a new encrypted database with the specified
' collating order.
Set dbsNew = wrkDefault.CreateDatabase(AccessFilePath, _
dbLangGeneral, dbEncrypt)

Set dbsNew = Nothing

'Demographic
Me.txtStatus.Text = "Running....." & vbCrLf & "Demographics & Volume"
Call AssocConcat

Dim qdfPassthrough As DAO.QueryDef
Dim rsCurr As DAO.Recordset
Dim strSQL As String

strSQL = "Exec [GetAssocDemographics&Volume&CB] @MonthYearList='" &
MyAssocDates & "', @OrderList='" & MyAssocNums & "'"

Set qdfPassthrough = CurrentDb().QueryDefs("qryPassThru")
qdfPassthrough.Sql = strSQL

DoCmd.RunSQL "SELECT * INTO [AssocDemoVol] IN '" & AccessFilePath & "'
FROM [qryPassThru];"

Set qdfPassthrough = Nothing
Set rsCurr = Nothing


This all works perfectly fine. What i want to do now is to place a query
into the new database. I don't know how to do this.
--
Billy Rogers

Dallas,TX

Currently Using SQL Server 2000, Office 2000 and Office 2003

http://thedataguru.blogspot.com/
.



Relevant Pages

  • Re: Code doesnt work on some computers
    ... suspect is a references problem. ... ' This section Creates the database. ... Dim wrkDefault As Workspace ... Set qdfPassthrough = CurrentDb.QueryDefs ...
    (microsoft.public.access.modulesdaovba)
  • Re: Code doesnt work on some computers
    ... suspect is a references problem. ... ' This section Creates the database. ... Dim wrkDefault As Workspace ... Set qdfPassthrough = CurrentDb.QueryDefs ...
    (microsoft.public.access.modulesdaovba)
  • Re: Is This Possible ... ? Yes - Upload images to an Access database
    ... It looks like your databases folder is outside the root of your web ... I created a database exactly as you said, the only change I made was to ... and underneath an 'upload' button and a 'view images' button. ... Dim con As New Data.OleDb.OleDbConnection ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Is This Possible ... ? Yes - Upload images to an Access database
    ... It looks like your databases folder is outside the root of your web ... I created a database exactly as you said, the only change I made was to ... and underneath an 'upload' button and a 'view images' button. ... Dim con As New Data.OleDb.OleDbConnection ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Is This Possible ... ? Yes - Upload images to an Access database
    ... I created a database exactly as you said, the only change I made was to ... upload it into the 'databases' folder, and not a folder called 'App_Data', ... and underneath an 'upload' button and a 'view images' button. ... Dim con As New Data.OleDb.OleDbConnection ...
    (microsoft.public.dotnet.framework.aspnet)

Loading