Message 1 of 8
Database Accsess
Not applicable
08-18-2006
10:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all
Here is my code to extract some data.(AutoCAD VBA code)
Private Sub CommandButton1_Click()
Dim rs As DAO.Recordset
Dim cn As DAO.Database
Dim a As String
a = TextBox1.Value
On Error Resume Next
Set cn = DBEngine.Workspaces(0).OpenDatabase("C:\John\X_data.mdb”)
Set rs = cn.OpenRecordset("SELECT code FROM table1 WHERE Char ='" + CStr(a) + "'")
If Err Then MsgBox Err.Description
TextBox2.Value = rs.Fields(0).Value
Set cn = Nothing
Set rs = Nothing
End Sub
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.
Please help me
Thanks
Benny
Here is my code to extract some data.(AutoCAD VBA code)
Private Sub CommandButton1_Click()
Dim rs As DAO.Recordset
Dim cn As DAO.Database
Dim a As String
a = TextBox1.Value
On Error Resume Next
Set cn = DBEngine.Workspaces(0).OpenDatabase("C:\John\X_data.mdb”)
Set rs = cn.OpenRecordset("SELECT code FROM table1 WHERE Char ='" + CStr(a) + "'")
If Err Then MsgBox Err.Description
TextBox2.Value = rs.Fields(0).Value
Set cn = Nothing
Set rs = Nothing
End Sub
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.
Please help me
Thanks
Benny