Please help me, am new to VB6.0

im doing database wherein in my ms access i have 12 tables, and i have to connect it to vb6.0 and display its contents...
is it possible to connect 2 to more than two tables in vb6.0?

please show me how to do it..
thanxz in advance!

Yes it is possible IF you have a primary and foreign key set in your tables. You will be using the INNER JOIN sql statement then to get the data from two tables.

Search google for more on INNER JOIN syntax and uses.:)

heres my code that is used to connect to my database from ms access

Private Sub Form_Load()

   Me.Hide
   Form2.Show
   
    Dim str As String
    
    Me.Caption = "Company Database"
    Set adoconn = Nothing
    adoconn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=LEAVE.mdb;Persist Security Info=False"
    str = "select * from January"
   
    rs.Open str, adoconn, adOpenDynamic, adLockPessimistic
    rs.MoveFirst
        txtno.Text = rs(0)
        txtname.Text = rs(1)
        lblplv.Caption = rs(2)
        lblpsl.Caption = rs(3)
        lbladlcvl.Caption = rs(4)
        lbladcsl.Caption = rs(5)
        lbllessvl.Caption = rs(6)
        lbllessdate.Caption = rs(7)
        lbllesssl.Caption = rs(8)
        lbllessdates.Caption = rs(9)
End Sub

my problem is how to include,February, March, April and so on ..., with this code... could u please help me..thanxz

You van use something like -

SELECT * FROM January
UNION
SELECT * FROM February

'etc...

yes,but its now working... can u show me more....

commented: No! have patience please. -2

i mean its not working yet.. can u show me more.. thanxz

Of what do I need to show you more? Be more specific please. Are you getting any errors? If so, what error?

Yeah am still getting error with it.. stil cant fetch the content of February from my database, though it is connected already.

I'm still not sure what error you get. Show me the code and where the error occur.

Alternatively (the long way around), have separate recordsets for each month, i.e. -

Dim con As ADODB.Connection
Dim rsJan As ADODB.Recordset
Dim rsFeb As ADODB.Recordset

Set con = New ADODB.Connection
con.Open "........your connection here...."

Set rsJan = New ADODB.Recordset
rsJan.Open "SELECT * FROM January", con, adOpenStatic, adLockOptimistic
rsFeb.Open "SELECT * FROM February", con, adOpenStatic, adLockOptimistic
'And so on...

@serolfaceh, please mark this thread as solved if you have managed to get a solution, found at the bottom of this page, thanks.:)

It has been open for some time now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.