468,301 Members | 1,532 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,301 developers. It's quick & easy.

How do i connect a VB 6.0 Form to an Access database

hello,

What are the steps that i should perform or what is the piece of code that i should use to connect an access database to a VB 6.0 Form? What is the piece of code for inserting , deleting viewing, editing data in the database? Where should i put the code?

Thanks
Nov 28 '06 #1
1 50838
Sky86
5
hello,

What are the steps that i should perform or what is the piece of code that i should use to connect an access database to a VB 6.0 Form? What is the piece of code for inserting , deleting viewing, editing data in the database? Where should i put the code?

Thanks

u got 2 option
1. using ado data control
2. using coding

using adodc
1. add a adodc
2. in the properties change
connect = Access
databasename = 'find the access file'
recordsource = 'the name of the table that want to link'
3. if want to link with the text box, in the change the properties
datasourse = 'the name of the adodc'
datafield = ' the field in the table that want to link'
4. coding of adding new records
Expand|Select|Wrap|Line Numbers
  1. data1.recordset.AddNew
5. coding of delete
Expand|Select|Wrap|Line Numbers
  1. data1.recordset.delete
6. coding of edit
Expand|Select|Wrap|Line Numbers
  1. data1.recordset.edit
7. coding of update
Expand|Select|Wrap|Line Numbers
  1. data1.recordset.update
8. coding of cancel update
Expand|Select|Wrap|Line Numbers
  1. data1.recordset.cancelupdate
9. move data or record
Expand|Select|Wrap|Line Numbers
  1. data1.recordset.movenext
  2.     data1.recordset.movefirst

using coding
try use this coding the different of other action is in SQL only

Expand|Select|Wrap|Line Numbers
  1. Dim con As New ADODB.Connection
  2. Dim con_string As String
  3. Dim sql As String
  4. Dim rs As New ADODB.Recordset
  5. con_string = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & App.Path & "\" & "abc.mdb;"
  6. con.Open con_string
  7.  
  8. sql = "select * from test where matrik = 123"
  9. Set rs = con.Execute(sql)
hope it help

-Sky86
Nov 28 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Krista | last post: by
reply views Thread by Kate Perry | last post: by
1 post views Thread by Yanick Quirion | last post: by
2 posts views Thread by CM Manager via DotNetMonster.com | last post: by
3 posts views Thread by LamSoft | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.