Inform Password in Excel VBA Code

G

gatarossi

Dear all,

I need to put the password of my ms access database in this code
below, but I don't know where.

This is a query to delete some data in ms access, that I run it in
excel.

Could anybody help me?

Thanks a lot!!!!


Sub del_cust_model()


Dim wrkSpace As DAO.Workspace
Dim db As DAO.Database
Dim qryDef As DAO.QueryDef
Dim qryNome As String
Dim strSQL As String
Dim strDB As String


'On Error Resume Next
strDB = ThisWorkbook.Path & "\bd_dynamic_query.mdb"


Set wrkSpace = Workspaces(0)
Set db = wrkSpace.OpenDatabase(strDB)
qryNome = "qryDelete"


db.QueryDefs.Delete qryNome


strSQL = "DELETE aux_cust_model.* FROM aux_cust_model "


Set qryDef = db.CreateQueryDef(qryNome, strSQL)


qryDef.Execute


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top