Microsoft
Software
Hardware
Network
Question : Simple ADODB Connection Error
I am trying to make a test ADO connection in a simple Access 2003 DB. This is what I have written (I've got nothing else yet, just trying the connection itself):
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
With cn
.ConnectionString = CurrentProject.Connection
.CursorLocation = adUseClient
.Attributes = .Attributes Or adXactCommitRetaining
.Open
End With
This code is activated by the Click event of a button. When I click the button, I get the following error:
"Run-time error '-2147467259(80004005)': Could not use "; file already in use."
Extra Info: In the Immediate Window, my CurrentProject.Connection string = "Provider=Microsoft.Jet.OL
EDB.4.0;Us
er ID=Admin;Data Source=C:\PMA 202\db1.mdb;Mode=Share Deny Read|Share Deny Write;Extended Properties="";Jet OLEDB:System database=C:\Documents and Settings\cmyers.ATO10\Appl
ication Data\Microsoft\Access\Syst
em.mdw;Jet
OLEDB:Registry Path=Software\Microsoft\Of
fice\11.0\
Access\Jet
\4.0;Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"
Also, the DB is not Read Only, is opened in Share, etc. This should be a very simple connection test, but I can't figure out what's gone wrong. Thanks. (Also, any instructions on what level of points this might be worth would be cool, this is my first time using this forum.)
Answer : Simple ADODB Connection Error
Actually I think this might work better:
Dim cn As Object
cn = CurrentProject.Connection
With cn
.CursorLocation = adUseClient
.Attributes = .Attributes Or adXactCommitRetaining
End With
Random Solutions
Validate bound field
Set number of Clients in WSUS ? 2
Calculated control error in Microsoft Access 2007 report
Should I use .NET Visual, ASP.NET, Silverlight, WCF and what database?
sql query help
installing quad port graphics card
Macro Help
How to set datagridview height with number of rows given?
SCCM Bare Metal installing Windows on wrogn drive
Forcing 32-bit VB.NET mode on 64-bit machine