Click to See Complete Forum and Search --> : More problems with system.mdw
Bob724
Jun 2nd, 2000, 01:11 AM
First look at this thread
http://forums.vb-world.net/showthread.php?threadid=18310
It was my fault to say at the end
I got it all squared away now.
There are more problems...
I installed Ms-Access on the computer and found the program that makes workgroups - I made my own .mdw file, too.
But now, every time I try to run my program, I get the run-time error '3049', which says "Can't open database ''. It may not be a database that your application recognizes, or the file may be corrupt."
Does anyone know how to get around this problem?
Please Help.
______
Bob K.
JHausmann
Jun 2nd, 2000, 05:27 AM
Put up your code where you're opening your database (dummy up the user id and password, for your protection).
Bob724
Jun 2nd, 2000, 06:09 AM
Sorry, What do you mean:
Put up your code
If you mean physically locate the code to be where I open the database, it is already there.
Otherwise, please explain further.
Thanks,
______
Bob K.
MartinLiss
Jun 2nd, 2000, 06:32 AM
What he means is that you should post your code so we can take a look at it.
JHausmann
Jun 2nd, 2000, 06:55 AM
The only code, in this thread segment OR the other, was put up by JimBob:
DBEngine.SystemDB = "c:\windows\system\system.mdw"
Set ws = CreateWorkspace("Ticketing", "Admin", "", dbUseJet)
If I were you, after dbengine.systemdb I would add:
DBEngine.DefaultUser= "username" 'the user that has the authority to open the database
DBnEngine.DefaultPassword="" 'password for the above user
Then Open the database with:
Set ws=CreateWorkspace(C:path\database.mdb")
Bob724
Jun 2nd, 2000, 10:23 PM
Marty: Thanks for the clarification. Here's the code I want to use
DBEngine.SystemDB = "C:\ServerProject\Server.mdw"
DBEngine.DefaultType = dbUseJet
Set UsrName = Workspaces(0).CreateUser("UserName", , "123456789")
Workspaces(0).Users.Append UsrName
Set WsNew = CreateWorkspace("SpecialWorkspace", "UserName", "123456789")
Workspaces.Append WsNew
Obviously, I had previously declared all those objects as the proper types.
I still get stupid error # 3049, though. I can't figure it out.
JHausmann: You can't use CreateWorkspace with a database name as the parameter. I did the other things you said, though, but I still get that error.
Any other suggestions? Am I writing the code wrong?
Please Help.
Thanks,
______
Bob K.
JHausmann
Jun 4th, 2000, 08:41 AM
Sorry. You've got no code to open the database.
Instead of what you have
Use:
global gdbDbase as dao.database
'then in the subroutine
DBEngine.SystemDB = "c:\windows\system\system.mdw"
DBEngine.DefaultUser= "username" 'the user that has the authority to open the database
DBEngine.DefaultPassword="" 'password for the above user
Set gdbDbase=Workspaces(0).OpenDatabase(path\database.mdb")
Then, when you reference recordsets, to do the work, you preceed the command with the open database.
for example, to read all the records from a table you would do:
Dim rsTest as Recordset
set rsTest= gdbDbase.CreateSnapshot("select * from table")
(in ADO I would use:
SQLString="Select * from table"
Set rsTest = gdbDbase.OpenRecordset(SQLString, ))dbOpenSnapshot)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.