user187573
user187573

Reputation: 171

vb6 recordset sql query

How to use append query in vb6 with access db having a password? The following is giving an error.

dim s as string
s="insert into patientprofile(crno) select patientprofile.crno from 'd:\liverrecord.mdb' & 'Jet OLEDB:Database Password=liver'"

Upvotes: 0

Views: 1313

Answers (1)

Guillaume Hanique
Guillaume Hanique

Reputation: 405

It's not exactly clear what you want. However,

You first have to reference Microsoft DAO 3.6 Object Library. You can then open a database with the following two lines.

Dim Engine As DAO.DBEngine: Set Engine = New DAO.DBEngine
Dim DB As DAO.Database: Set DB = _
       Engine.Workspaces(0).OpenDatabase("D:\LiveRecord.mdb", false, false, _
       "MS Access;PWD=liver")

You can access the sql statement with

Call DB.Execute("insert etc")

Upvotes: 1

Related Questions