|
-
Sep 24th, 1999, 01:10 PM
#1
Thread Starter
New Member
Anyone know how to use access queries from visual basic using code. Any information on using code and access database is welcome. How to lock a db, etc.
-
Sep 24th, 1999, 07:24 PM
#2
New Member
Add a reference to DAO 3.51 object library from the project menu.
Then write the foll. routine in your project
Sub InitDB()
Dim WS as Workspace
Dim DB as Database
Dim RS as Recordset
Set WS = DBEngine.Workspaces(0)
Set DB = WS.Opendatabase("C:\MyData.mdb")
Set RS=DB.OpenRecordset("Select * from Employee where EmpNo = 10")
With RS
Text1= .fields("EmpNo")
Text2= .fields("EmpName")
Text3= .fields("Address")
Text4= .fields("Phone")
End With
End Sub
Add 4 text boxes and call initdb in your form load event after filling the database with some values
To add values in the database use .Addnew and .Update
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|