Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make table query...

Status
Not open for further replies.

terre

Technical User
Feb 2, 2003
97
AU
I am writing a database that needs me to create a database in another folder.......naming it according to the user
I can create the database

Dim strExportdbName As String
Dim strDestination As String

strExportdbName = Forms!Start!SiteName & " Export.mdb"
strDestination = "C:\VET\" & strExportdbName


Set dbsExport = DBEngine.Workspaces(0).CreateDatabase(strDestination, DB_LANG_GENERAL)


But then cannot get the query to make a table in it.
Is this possible?

strExportQ1 = "SELECT DISTINCTROW Question1.* "
strExportQ1 = strExportQ1 & "INTO Q1Export IN 'strDestination'"
strExportQ1 = strExportQ1 & "FROM Question1 "
strExportQ1 = strExportQ1 & "WHERE ((Question1.ToBeExported=Yes));"
DoCmd.RunSQL strExportQ1


That is the destination database may change depending on the user.

Any suggestions would be greatly appreciated
 
well,,,it creates the database.......

then tells me it cant find the database when it tries to make the table

Cant find c:\DocumentsandSettings\'strDestination'
 
Could it be that you should have:

strExportQ1 = strExportQ1 & "INTO Q1Export IN " & strDestination & " "


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Replace this:
strExportQ1 = strExportQ1 & "INTO Q1Export IN 'strDestination'"
By this:
strExportQ1 = strExportQ1 & "INTO Q1Export IN '" & strDestination & "'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank you thank you.....works like a charm........


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top