Sad Der
accessd666 at yahoo.com
Mon Jan 26 07:58:31 CST 2004
I create a new database. After that I set Db back to current db. Then I loop through all queries in current db searching for my MakeTable queries. Using my CreateTable function I start the MakeTable queries. You're corrected in saying that I should use 2 objects but...I didn't. I tested it and it worked. Worked...that is. because now it want's to create the tables on c:\.... Sander --- Erwin Craps - IT Helps <Erwin.Craps at ithelps.be> wrote: > I don't understand why you create a new database in > "set db" and then > set db back to the current one. > If you do "For Each qdf In db.QueryDefs" > > If you create a table in db that would be the > current db and not the new > db?! > If function "CreateTables" does create the table in > new db, then that > should be fine but... > > You should db.close before setting it to the current > one. > Even better use dim dbCurr en dim dbNew statements > for avoiding > confusion. > > Please note that you do not need to close currentdb > (dbCurr.close). > Just set it to nothing. > > > Erwin > > > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On > Behalf Of Sad Der > Sent: Monday, January 26, 2004 11:28 AM > To: Acces User Group > Subject: [AccessD] Make-table query points to > c:\documents and > settings?! > > Hi group, > > I've created a routine that creates a new DB.This > Temp_Db is created in > the same directory as the FE. > > I then use a couple of MAKE TABLE-queries to create > tables in the > temp_db. > > This worked great. Now, i'm getting errors that my > MAKE_TABLE-queries > cannot find the Temp_db!? > I get this error: > Err.Number = 3024 > Err.Description =Could not find file: C:\Documents > and Settings\.... > > As you can see it points to C:\Documents and > Settings. > However the temp_db is created on my d:\projects\... > > Here's the code I use: > ******************************************************* > Else > Set db = Workspaces(0).CreateDatabase(strPath > & "TEMP_FE_" & > strFile, dbLangGeneral) > Set db = CurrentDb() > Set qdf = New DAO.QueryDef > > '------------------------------------------------ > 'Create tables in newly created database > > '------------------------------------------------ > 'Loop through query list > For Each qdf In db.QueryDefs > 'check if qryName starts with qryMake_ > If InStr(1, qdf.Name, "qryMake_") Then > Call CreateTables(qdf.Name) > x = x + 1 > End If > Next > Call MsgBox("The following objects have been > created:" & vbCrLf & > _ > " - Temporary database" & vbCrLf > & _ > " - " & x & " Tables", > vbInformation + > vbDefaultButton1, "Objects created") > > End If > ******************************************************* > Any idea's why it points to C:\documents and > Settings? > When I created the make table queries I selected the > temp_db. > > Sander > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. > Try it! > http://webhosting.yahoo.com/ps/sb/ > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/