PDA

View Full Version : Securing XML



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


rdShippers.Close
dbRibbonData.Close

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?

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

Roderick
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?

Roderick
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:

mancubus
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
https://access-programmers.co.uk/forums/showthread.php?t=178072
post #7

mancubus
11-29-2017, 12:06 AM
another:



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


https://answers.microsoft.com/en-us/msoffice/forum/msoffice_access-mso_other-mso_2010/use-dao-to-open-a-password-protected-access-2010/7193f26f-a275-e011-8dfc-68b599b31bf5

Roderick
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!