View Full Version : Securing XML

11-24-2017, 03:16 PM
I use an Access database to populate my XML details for a Word template Ribbon Bar.

This is the code that I use to access, in this case, the Labels for the various buttons, etc on the Ribbon:

Set dbRibbonData = OpenDatabase(Name:=inifileloc2)

'searches the Registry for the set language
myLanguage = GetSetting("GA", "Template Language", "Language")

'search the database in the 'Template_Labels' table in the 'language' field for the 'control.id' record
strSQL = "Select " & myLanguage & " FROM [Template_Labels] where [Field_Code] = '" & rxMyLabel & "'"

Set rdShippers = dbRibbonData.OpenRecordset(strSQL, dbOpenDynaset)

'return the value back to the Ribbon XML
On Error Resume Next
returnedVal = rdShippers.Fields(0)


If I were to password protect my Access database to stop people editing it, can I put a password in my code somewhere that will allow it to read the data which feeds back into the XML?

11-27-2017, 08:01 AM
Modertor bump

11-27-2017, 03:10 PM
I'm sorry, but the above seems a very unreasonable way to explain why 'modertor' (sic) has been inserted in a reply of some kind. Bump what? To where? After all, it deals with a legitimate question about the Ribbon Bar. If it was wrong or in the wrong place a more helpful answer would have been, errr...more helpful?

11-28-2017, 01:17 AM
This is a big grovelling apology to the Moderator. I didn't know what "bump" meant. I thought it meant I was being "bumped off" from the thread.

I now know he was being helpful in "bumping" it back into the readers' vision.

So sorry! :friends:

11-29-2017, 12:00 AM
hope this helps

Public obDAO As DAO.Workspace, obDB As DAO.Database
Sub OpenConnection()

Set obDAO = DAO.DBEngine.Workspaces(0)
Set obDB = obDAO.OpenDatabase(strDBPath, False, False, ";pwd=" & DBPass & "")
ConnectionState = True
End Sub

Where strDBPath is the full path and file name that you want to open and DBPass is the active password
post #7

11-29-2017, 12:06 AM

Public Function OpenEncryptedDatabase()

Dim DB As DAO.Database
Dim rec As DAO.Recordset
Dim wrkspc As DAO.Workspace

Set wrkspc = Access.DBEngine(0)
Set DB = wrkspc.OpenDatabase("<your database here>", False, True, "MS Access;PWD=password")
Set rec = DB.OpenRecordset("select * from table1")
End Function


11-29-2017, 08:17 AM
Thank you so much for those helpful answers. Will go away and try them out.

When I look at them, the results seem quite simple. But could I find them? Not a chance!

Thanks again!