Results 1 to 7 of 7

Thread: Password protected database & Word

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    16

    Password protected database & Word

    Hi: Using VB6, Access2000, Word2000

    I trying to do a mailmerge using VB6 & Word2000 with an Access2000
    password protected database. I don't know how to provide the password
    to the string.

    Normally when accesing the db I connect as follows:

    VB Code:
    1. 'adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    2. '" Data Source=\\BigDaddy\Datalib\MegaOne.mdb; Persist Security Info=False; Jet OLEDB:Database Password=DogDayAfternoon23x "

    I tried the above code but got errors


    The following is what I'm currently using, but it prompts me to
    enter the password, which I do not want to happen once itgets into production.

    VB Code:
    1. ' Set the mail merge data source as the MegaOne.mdb database.
    2. objWord.MailMerge.OpenDataSource _
    3. Name:="\\BigDaddy\Datalib\MegaOne.mdb", _
    4. LinkToSource:=True, _
    5. Connection:="TABLE Customers", _
    6. SQLStatement:=" SELECT " & _
    7. " CustAuthorizedFirstName, CustAuthorizedLastName," & _
    8. " CustDepartment, CustCompanyName, " & _
    9. " CustAddress1, CustAddress2, " & _
    10. " CustCity, CustState, CustZipcode, " & _
    11. " CustBalance " & _
    12. " FROM " & _
    13. " [Customers]" & _
    14. " Where " & _
    15. " CustBalance > 0 "

    The second problem I'm having here is that the document is set with a font size of 12 but when prints, the first word of the merged fields are printed with a font size of 10 instead of the original document which as I stated is set for 12.

    Can someone shed some light?

    Thanks

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    16

    Re: Password protected database & Word

    Anyone out there, Need HELP with this.

    Thanks

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Password protected database & Word

    According to this page (which is an explanation of why things like this can be a bad idea!) there is a PasswordDocument parameter, which I think should be inserted like this:
    VB Code:
    1. ...
    2. Name:="\\BigDaddy\Datalib\MegaOne.mdb", _
    3. PasswordDocument:="[i]YourPassword[/i]", _
    4. LinkToSource:=True, _
    5. ...

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    16

    Re: Password protected database & Word

    Thanks for responding si_the_geek. Sorry for the late response but I was under the weather for a bit. Back at work now.

    I tried your suggestionn and it still prompts me for the database password, appearently it a document password instead of the database password.

    Any other thoughts???

    And how about the changing of the font size problem?

    Again thanks

  5. #5
    New Member
    Join Date
    Dec 2005
    Posts
    4

    Re: Password protected database & Word

    Got this from the Microsoft TechNet site:

    VB Code:
    1. ' Open database for exclusive access by using current password. To
    2. ' get exclusive access, you must set the Options argument to True.
    3. Set dbsDB = OpenDatabase(Name:=strDBPath, _
    4. Options:=True, _
    5. ReadOnly:=False, _
    6. Connect:=strOpenPwd)

    Looks like you would assign you parameters to the variables starting with 'str'

    Hope that helps !


  6. #6
    New Member
    Join Date
    Dec 2005
    Posts
    4

    Re: Password protected database & Word

    http://www.microsoft.com/technet/pro...art4/ch18.mspx

    Sorry, the above is the link where I got some info ......

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    16

    Re: Password protected database & Word

    Thanks for the information & the link ModusOperandi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width