Greggs
greggs at msn.com
Fri Oct 10 10:03:33 CDT 2003
I have a database that opens a second database using sendkeys (ugly huh?).
I need to switch to DAO so I can open a password protected database. I have
used the code from the knowledge base
http://support.microsoft.com/default.aspx?scid=kb;en-us;161016&Product=acc97
but I can't get it to close the first database and open a form in the
second.
here's the code from the Knowledge base...
Sub OpenDB()
Dim db As Database
Dim ws As WorkSpace
Dim rst As Recordset
Set ws = DBEngine.WorkSpaces(0)
Set db = ws.OpenDatabase _
("C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb", _
False, False, "MS Access;PWD=northwind")
Set rst = db.OpenRecordset("Customers", dbOpenDynaset)
If rst.RecordCount > 0 Then
rst.MoveLast
MsgBox rst!CustomerID
End If
rst.Close
db.Close
End Sub
Do I have to open an application first?