<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Database Accsess in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740707#M31753</link>
    <description>thanks jon &lt;BR /&gt;
&lt;BR /&gt;
But can you explain me which  are the refrences to be added for ADO.</description>
    <pubDate>Mon, 21 Aug 2006 03:58:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-08-21T03:58:05Z</dc:date>
    <item>
      <title>Database Accsess</title>
      <link>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740703#M31749</link>
      <description>Hi all&lt;BR /&gt;
&lt;BR /&gt;
Here is my code to extract some data.(AutoCAD  VBA code)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Private Sub CommandButton1_Click()&lt;BR /&gt;
Dim rs As DAO.Recordset&lt;BR /&gt;
 Dim cn As DAO.Database&lt;BR /&gt;
&lt;BR /&gt;
Dim a As String&lt;BR /&gt;
a = TextBox1.Value&lt;BR /&gt;
 &lt;BR /&gt;
 On Error Resume Next&lt;BR /&gt;
 Set cn = DBEngine.Workspaces(0).OpenDatabase("C:\John\X_data.mdb”)&lt;BR /&gt;
 Set rs = cn.OpenRecordset("SELECT  code  FROM table1 WHERE  Char  ='" + CStr(a) + "'")&lt;BR /&gt;
&lt;BR /&gt;
 If Err Then MsgBox Err.Description&lt;BR /&gt;
 TextBox2.Value = rs.Fields(0).Value&lt;BR /&gt;
  &lt;BR /&gt;
 Set cn = Nothing&lt;BR /&gt;
 Set rs = Nothing&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
My above code is working fine, but if I lock the database (Locking database with user name “Admin” and password ”xyz”, I don’t know how to unlock through the code and read values.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Please help me&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Benny</description>
      <pubDate>Sat, 19 Aug 2006 05:15:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740703#M31749</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-19T05:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Database Accsess</title>
      <link>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740704#M31750</link>
      <description>Benny,&lt;BR /&gt;
&lt;BR /&gt;
If your database is locked with an admin password you are able to access it via DAO using either the OpenDatabase or OpenConnection methods.&lt;BR /&gt;
&lt;BR /&gt;
Since your using the OpenDatabase method, the DAO help files indicate the method arguments are:&lt;BR /&gt;
&lt;BR /&gt;
OpenDatabase (dbname, options, read-only, connect)&lt;BR /&gt;
&lt;BR /&gt;
With your code your only using the dbname argument.&lt;BR /&gt;
&lt;BR /&gt;
Options will allow you to open the database in Exclusive (True) or Shared mode (False) which is the default.&lt;BR /&gt;
&lt;BR /&gt;
Read-Only will allow you to open the database in a Read Only mode (True) or the default which is Read/Write access (False).&lt;BR /&gt;
&lt;BR /&gt;
Connect specifies your connection info and password.&lt;BR /&gt;
&lt;BR /&gt;
So to get what you want try changing:&lt;BR /&gt;
&lt;BR /&gt;
Set cn = DBEngine.Workspaces(0).OpenDatabase("C:\John\X_data.mdb”)&lt;BR /&gt;
&lt;BR /&gt;
To&lt;BR /&gt;
&lt;BR /&gt;
Set cn = DBEngine.Workspaces(0).OpenDatabase("C:\John\X_data.mdb”, False, False, "pwd=YourPassword")&lt;BR /&gt;
&lt;BR /&gt;
When someone posts a connect to MS Access using DAO it is inevitable that someone comes along and shouts you should be using ADO....which I would agree.&lt;BR /&gt;
&lt;BR /&gt;
To get you trying that path read up here on opening an Access MDB that is password protected with ADO:&lt;BR /&gt;
&lt;BR /&gt;
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q191/7/54.ASP&amp;amp;NoWebContent=1&lt;BR /&gt;
&lt;BR /&gt;
G'Luck,&lt;BR /&gt;
&lt;BR /&gt;
Bob Coward</description>
      <pubDate>Sat, 19 Aug 2006 11:28:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740704#M31750</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-19T11:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Database Accsess</title>
      <link>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740705#M31751</link>
      <description>DAO is pretty much out of date, and ActiveX Data Objects (ADO) is much&lt;BR /&gt;
easier and can do much more.  Add a reference to the ADO library and try:&lt;BR /&gt;
&lt;BR /&gt;
  Dim a As String&lt;BR /&gt;
  a = TextBox1.Value&lt;BR /&gt;
  Dim oConn As ADODB.Connection&lt;BR /&gt;
  Dim oRS As ADODB.Recordset&lt;BR /&gt;
  Dim strSQL As String&lt;BR /&gt;
  Set oConn = New ADODB.Connection&lt;BR /&gt;
  Set oRS = New ADODB.Recordset&lt;BR /&gt;
  oConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0"&lt;BR /&gt;
  oConn.Open "C:\John\X_data.mdb”, "Admin", "xyz"&lt;BR /&gt;
  strSQL = "SELECT  code  FROM table1 WHERE  Char  ='" + CStr(a) + "'"&lt;BR /&gt;
  oRS.Open strSQL, oConn&lt;BR /&gt;
  oConn.Close&lt;BR /&gt;
  Set oConn = Nothing&lt;BR /&gt;
  Set oRS = Nothing&lt;BR /&gt;
&lt;BR /&gt;
Note; I haven't tested this, you may have to replace the single-quotes in&lt;BR /&gt;
the SQL string with double-quotes, or change the Jet OLEDB:ODBC Parsing&lt;BR /&gt;
property (in the Properties collection of the Connection object) to True.&lt;BR /&gt;
&lt;BR /&gt;
In addition to any replies you might receive or already received, you may&lt;BR /&gt;
find more information or responses by posting future connectivity related&lt;BR /&gt;
questions in the following discussion group: &lt;BR /&gt;
 &lt;BR /&gt;
Web browser: &lt;&gt; &lt;BR /&gt;
Newsreader: &lt;&gt;&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
jrf &lt;BR /&gt;
Autodesk Discussion Group Facilitator &lt;BR /&gt;
Please do not email questions unless you wish to hire my services&lt;BR /&gt;
&lt;BR /&gt;
On Sat, 19 Aug 2006 05:15:26 +0000, benny wrote:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Hi all&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Here is my code to extract some data.(AutoCAD  VBA code)&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Private Sub CommandButton1_Click()&lt;BR /&gt;
&amp;gt; Dim rs As DAO.Recordset&lt;BR /&gt;
&amp;gt;  Dim cn As DAO.Database&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Dim a As String&lt;BR /&gt;
&amp;gt; a = TextBox1.Value&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt;  On Error Resume Next&lt;BR /&gt;
&amp;gt;  Set cn = DBEngine.Workspaces(0).OpenDatabase("C:\John\X_data.mdb”)&lt;BR /&gt;
&amp;gt;  Set rs = cn.OpenRecordset("SELECT  code  FROM table1 WHERE  Char  ='" +&lt;BR /&gt;
CStr(a) + "'")&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;  If Err Then MsgBox Err.Description&lt;BR /&gt;
&amp;gt;  TextBox2.Value = rs.Fields(0).Value&lt;BR /&gt;
&amp;gt;   &lt;BR /&gt;
&amp;gt;  Set cn = Nothing&lt;BR /&gt;
&amp;gt;  Set rs = Nothing&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; My above code is working fine, but if I lock the database (Locking&lt;BR /&gt;
database with user name “Admin” and password ”xyz”, I don’t know how to&lt;BR /&gt;
unlock through the code and read values.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Please help me&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt; Benny&lt;/&gt;&lt;/&gt;</description>
      <pubDate>Sun, 20 Aug 2006 13:12:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740705#M31751</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-20T13:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Database Accsess</title>
      <link>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740706#M31752</link>
      <description>Thanks bcoward for your detailed explanation.&lt;BR /&gt;
&lt;BR /&gt;
Modified my code i e&lt;BR /&gt;
set cn=DBEngine.Workspaces(0).OpenDatabase("C:\John\X_data",False,False,"pwd=xyz")&lt;BR /&gt;
&lt;BR /&gt;
But it is giving error(no-3151)- ODBC connection to "C:\John\X_data.mdb" failed.&lt;BR /&gt;
&lt;BR /&gt;
Can you help in to solve this problem.&lt;BR /&gt;
&lt;BR /&gt;
You have mention me to use ADO but I dont know which are the refrences to be added for ADO,i  tried adding some &lt;BR /&gt;
but it is giving me error declaration stage itself.</description>
      <pubDate>Mon, 21 Aug 2006 03:56:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740706#M31752</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-21T03:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Database Accsess</title>
      <link>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740707#M31753</link>
      <description>thanks jon &lt;BR /&gt;
&lt;BR /&gt;
But can you explain me which  are the refrences to be added for ADO.</description>
      <pubDate>Mon, 21 Aug 2006 03:58:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740707#M31753</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-21T03:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Database Accsess</title>
      <link>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740708#M31754</link>
      <description>Thanka all&lt;BR /&gt;
with little bit trial and error I GOT IT  !!!!</description>
      <pubDate>Mon, 21 Aug 2006 09:37:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740708#M31754</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-21T09:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Database Accsess</title>
      <link>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740709#M31755</link>
      <description>On Mon, 21 Aug 2006 03:58:05 +0000, benny wrote:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; But can you explain me which  are the refrences to be added for ADO.&lt;BR /&gt;
&lt;BR /&gt;
In case you still need this:  in The Visual Basic editor (Alt-F11) click&lt;BR /&gt;
"Tools" "References", scroll down to "Microsoft ActiveX Data Objects ...&lt;BR /&gt;
Library", and put check-mark next to the highest numbered version listed.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
jrf &lt;BR /&gt;
Autodesk Discussion Group Facilitator &lt;BR /&gt;
Please do not email questions unless you wish to hire my services</description>
      <pubDate>Mon, 21 Aug 2006 12:43:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/1740709#M31755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-21T12:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Database Accsess</title>
      <link>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/5844956#M31756</link>
      <description>&lt;P&gt;I need to find out how to access the code for 123d design. any idea on how I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 12:44:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/database-accsess/m-p/5844956#M31756</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-05T12:44:38Z</dc:date>
    </item>
  </channel>
</rss>

