Hi Connie,
Unfortunately I am not able to help directly as I do not use the user
level security stuff. Where it is important I usually use a secure backend
that does its own prompting. The users just have to deal with the prompting
when doing the few Word merges that they use.
I do have a few ideas, that may or may not help. Some are predicated
on the output data in the temporary table not needing protection from being
view by anyone with access to the Word template. Probably not a big issue.
Is it possible to tell Word to store the user name and password? If so, you
could set up a generic Merge user that has access to the temporary table. Or
if that does not work, how about a level of indirection--that is create a
separate non-secured database with a linked table to the original database,
again using a generic Merge user and saving the password with the link? Then
use the non-secured database as the source for the Word document. Finally as
another variation, place your temporary table in a non-secured database and
in the main database delete the current temporary table and link to the
temporary table in the non-secure database. Again, use the non-secure
database as the source of the merge data. You could add in removal of the
records from the temporary table at the end of the process.
Hope that is of some help,
Clifford Bass
css said:
Clifford:
Basically, I'm running a query to search my database for data & put in all
in a temporary table; TempMerge. The word template references this table.
When I log directly in to word to edit the template, I'm asked for my log in
& password for access. I've set up each user in access under Security.
Problem is, when a user has already ready logged in to Access & run the vb
code/query, they are prompted again for their Access user id & password. The
code opens the template (whatever one for each specific item), merges it with
the temp table, prints it & closes Access. The user doesn't even see it
happen on the screen.
I really don't want to make them log in again since it's all happening in
background. I can pull the user id from the CurrentUser, but don't know how
to get the password.
Here's the code:
'look up template name for item
str = "[dept]=" & dept & " AND [cat]=" & cat & " AND [item]=" & item
TName = Nz(DLookup("[Link]", "OffRentLinks", str))
If TName = "" Then
str = MsgBox("No Service Document", vbInformation)
Quit
End If
TName = "S:\Shared Documents\ServiceProcedures\" & TName 'word merge doc to
open
'opens word
Set wordApp = New Word.Application
wordApp.Visible = False 'whether or not to show word, just print
'opens template
Set wordDoc = wordApp.Documents.Open(TName, , , , , "TemplatePassword")
'prints document
wordApp.Options.PrintBackground = False
wordApp.ActiveDocument.PrintOut
'closes document
wordDoc.Close (False)
'closes word
wordApp.Quit
Any ideas?
Connie