DAO vs ADO in VB6

  • Hi,

    I use a make table quey (DAO) in my vb6 application. it goes like below;

    set dbSource = OpenDatabase("m:\testdbSource\testSource.mdb")

    qrySQL = "select * into tblA in 'v:\testdb\test.mdb' from tblSource"

    set qry = dbSource.CreateQueryDef("", qrySQL)

    qry.Execute

    qry.close

    set qry = nothing

    m and v are network drives.

    Is there an equivalent statement in ADO? Your help will be greatly appreciated. Thank you.

    Dong

  • Sorry no, but you could try asking these guys:

    http://www.access-programmers.co.uk/forums

    I have found them very helpful in the past..

  • Thank you Paul. I'll try the link.

  • Dong Lee (5/19/2008)


    set dbSource = OpenDatabase("m:\testdbSource\testSource.mdb")

    qrySQL = "select * into tblA in 'v:\testdb\test.mdb' from tblSource"

    set qry = dbSource.CreateQueryDef("", qrySQL)

    qry.Execute

    qry.close

    set qry = nothing

    Never seen anything like that before, but that is handy! Please post what you find, if you don't mind.

  • Based on this post, I think you could do this:

    Dim cnn As New ADODB.Connection

    Dim cmd As New ADODB.Command

    Dim strSql As String

    cnn.ConnectionString = _

    "Provider=Microsoft.Jet.OLEDB.4.0;" & _

    "Data Source=m:\testdbSource\testSource.mdb;" & _

    "User Id=admin;Password=;"

    cnn.Open

    cmd.ActiveConnection = cnn

    cmd.CommandType = adCmdText

    cmd.CommandText = "select * into tblA in 'v:\testdb\test.mdb' from tblSource"

    cmd.Execute

    Set cmd = Nothing

    cnn.Close

    Set cnn = Nothing

    I haven't tested this, but it looks like it should work based on the above article.

    Let me know if it works.

  • It works. Thank you Ryan.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply