PDA

View Full Version : Solved: Automatic login



calenger
07-20-2005, 05:14 PM
Hi Again

Does anyone now how, through a vbscript (previous thread), to automaticly login to a pasword protected access 200 database?

Brandtrock
07-25-2005, 02:42 AM
I assume that you (or your end user) have permission to access the database and you are asking how to use the known quantities (username and password) to log in.

Is that accurate?

No link to your previous thread, and I am being a tad lazy by not searching for it.

Regards,

calenger
07-25-2005, 06:29 AM
Hi thanks for reading

Yes it is our statistical database and do have full access. The goal is to make a night time import utility work.

xCav8r
07-25-2005, 04:46 PM
Just has a database password? No workgroup protection?

calenger
07-26-2005, 06:54 AM
Hi again

no. no workgroup only an admin login and user login

xCav8r
07-26-2005, 08:33 AM
Sub OpenDatabaseX()
Dim wrkJet As Workspace
Dim dbsNorthwind As Database
Dim dbsPubs As Database
Dim dbsPubs2 As Database
Dim dbsLoop As Database
Dim prpLoop As Property
' Create Microsoft Jet Workspace object.
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
' Open Database object from saved Microsoft Jet database
' for exclusive use.
MsgBox "Opening Northwind..."
Set dbsNorthwind = wrkJet.OpenDatabase("Northwind.mdb", _
True)
' Open read-only Database object based on information in
' the connect string.
MsgBox "Opening pubs..."

' Note: The DSN referenced below must be set to
' use Microsoft Windows NT Authentication Mode to
' authorize user access to the Microsoft SQL Server.
Set dbsPubs = wrkJet.OpenDatabase("Publishers", _
dbDriverNoPrompt, True, _
"ODBC;DATABASE=pubs;DSN=Publishers")
' Open read-only Database object by entering only the
' missing information in the ODBC Driver Manager dialog
' box.
MsgBox "Opening second copy of pubs..."
Set dbsPubs2 = wrkJet.OpenDatabase("Publishers", _
dbDriverCompleteRequired, True, _
"ODBC;DATABASE=pubs;DSN=Publishers;")
' Enumerate the Databases collection.
For Each dbsLoop In wrkJet.Databases
Debug.Print "Database properties for " & _
dbsLoop.Name & ":"
On Error Resume Next
' Enumerate the Properties collection of each Database
' object.
For Each prpLoop In dbsLoop.Properties
If prpLoop.Name = "Connection" Then
' Property actually returns a Connection object.
Debug.Print " Connection[.Name] = " & _
dbsLoop.Connection.Name
Else
Debug.Print " " & prpLoop.Name & " = " & _
prpLoop
End If
Next prpLoop
On Error GoTo 0
Next dbsLoop
dbsNorthwind.Close
dbsPubs.Close
dbsPubs2.Close
wrkJet.Close
End Sub

calenger
07-28-2005, 05:18 PM
Hey how you doing . Hows your dog?

thanks. I will work on it as soon as I put out my other fire :)

xCav8r
07-28-2005, 06:57 PM
Thanks for asking. My dog is almost back to normal. His breathing is still a little shallow, and his rear legs can wobble, but he's shown gradual and steady improvement. At this rate, in another week or two he ought to be back to his former spunky self.

calenger
07-29-2005, 05:09 AM
Good to hear.

Did you ever figure out what happen?

xCav8r
07-29-2005, 11:14 PM
Unfortunately, no.