tags:

views:

68

answers:

1

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'"

+1  A: 

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")

I hope this helps.

Guillaume Hanique

Guillaume Hanique