Vb.6 & Ms, Access Help...
Submitted by himalayan_sage on Tuesday, September 15, 2009 - 19:10.
Hi...Everyone I am new to this community I have noticed that here all the quries are resolved systamatically seeing this I have also asked my friends to join it..I have a query and this is my 1st one so hope for a best reply,I want to insert the data in Ms Access through code using in vb6. Could I,
get a best asvise for it.Tahnks,I am deliberatly seeking for the replies.
VB code for communicating MS Access
Dim ws As Workspace
Dim db As Database
Dim rs As Recordset
Private Sub Command1_Click()
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("Myaccessfile.mdb")
Set rs = db.OpenRecordset("Table1", dbOpenTable)
End Sub
' where as Myaccessfile.mdb -> is File name, Table1 is the table name
re: Vb.6 & Ms, Access Help...
You are using the old way (DAO) of connecting to a database. ADO is the new technology to connect to a database.
Anyway you can do this the same with ADO:
- with rs
- .addnew
- !Field1 = txtLastname.text
- !Field1 = txtFirstname.text
- .update
- end with
Add new comment
- Add new comment
- 11 views