A SMALL VB6 CODE WHICH USES MS ACCESS DATABASE

This is very small program which explains how the database is connected to the visualbasic 6, If you run this program, the data  EmpName in the first record of the table 'EMP' will be displayed in the textbox.

step 1: create a form.
step 2. In that form create a textbox with name 'text1'
step 3. write the following code under 'GENERAL'
             Dim Rs as New ADODB.Recordset
step 4: write the following code under 'FORM'
            Private Sub form_load()
                 call dbOpenCon
                 sql="select * from emp"
                 rs.open sql.con,adOpenDynamic,adLockpPessimistic
                 text1.text=rs!EmpName
            End Sub
step 5: Create a module and save as module1.bas  . This module should contain
           the following code:
            Public con as New adodb.connection
            Public sub dbOpenCon()
                 srconnection="provider=microsoft.jet.oledb.4.0;" &_
                 "data source=" & app.Path & "emp.mdb;persist security ifo=false'
                 con.ppen strconnection
            End Sub
step 6. Now run this program
===================================

each statement should be writen in a single line. But if the length of a statement is very long,
we would like to jump to the next line. How to handle this situation:
x="Once upon a time I went to Newyark"

The above one line statement can be writen in two lines as shown below:
x="Once upon a time I " &_
"went to Newyark"

another example: in this case no double-qoute is invoved:
form1.designationTextbox.Text=form1.post.Textbox.text
the above single line statement can be writen in two lines as shown here:
form1.designationTextbox.Text=form1. _
post.Textbox.text



=====================================================
For learning VB6, you should create some basic projects for yourself. http://www.vb6.us/ is a very good site
for beginners.
FOLLOWING ARE SOME OF THE VB6 PROGRAMS FOR BEGINNERS(complete source code is given)


Thank you spending your time here.
If possible you; can leave some comments or suggestions.
Thanks a lot once again.
Google Search
Disclaimer and Copy Right