From Excel Icon open encrypted Access db

Mike Scott

New Member
Joined
Nov 20, 2020
Messages
2
Office Version
  1. 2016
Hello! I have set up a macro on excel that opens our access database, and it works but only opens the password prompt window.
I have the macro attached to an icon in the quick access toolbar. I need to include a code that will add a password and open the switchboard.
Can anyone help?



Sub Macro9()

'Access object

Dim appAccess As Access.Application

'create new access object

Set appAccess = New Access.Application

'open the acces project

Call appAccess.OpenCurrentDatabase( _

"C:\VSAIS\VSAISApp.accdb")

appAccess.Visible = True


End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Sorry, we are running office 2016. We had everything updated from 2010 to 2016. Our small business' information system is Access db. Since I got no help yesterday, I suppose that I should say that there are several macro codes online I've been trying to copy and paste to the one above and none of them work. One below for example. Each of us have our own copy of the accdb with our own passwords. The Excel Icon will be programmed to open Access db to whatever client form is currently in use on Excel. I really need help.

Dim strSQL As String

Dim adoRecSet As New ADODB.Recordset

Dim connDB As New ADODB.Connection

connDB.Open ConnectionString:="Provider = Microsoft.ACE.OLEDB.12.0; Data Source=C:\VSAIS\VSAISApp.accdb; Jet OLEDB: Database

Password=xxxxxxxx"

strSQL = "SELECT * FROM Stocks"

adoRecSet.Open Source:=strSQL, ActiveConnection:=connDB, CursorType:=adOpenDynamic, LockType:=adLockOptimistic

Sheets("Stocks").Select

ActiveSheet.Range("A1").CopyFromRecordset adoRecSet

adoRecSet.Close

connDB.Close

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,432
Messages
6,124,858
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top