As it says in the title.
See code. When I run this, not only does it ask me whether to save, which it should do automatically, but when I OK the save, I get this error:
"The password is too long"
error 5476 at line 340
When I OK this, it still saves as requested. The .docx is still protected by the password.
Why do I get this message? It all works fine in Access 2002.
GrahamSkan, if you are listening, you appear to have deal with a similar question in Februay but it has been deleted.
10 On Error GoTo createApp ' create a Word app
20 Set docapp = GetObject(, "Word.Application")
30 On Error GoTo logInNotes_Error
40 On Error GoTo notFound
50 password = DLookup("[password readwrite]", "[my details]")
60 Set docdoc = docapp.Documents.Open("C:\program files\COUNSELOG 4.2\cg4 docs\" & _
Forms!switchboard!thisuser & "\" & Forms![counselling log].client_on_form & ".docx", _
, , , password, , , password)
'... all sorts of code to write to the .docx...
340 docdoc.Close wdSaveChanges