Results 1 to 12 of 12
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: .Destination = wdSendToPrinter problem

    Hi, i am still have a question about requested object is not found.
    The code is :

    Case "Regular2"
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Qry_Regular2_Report", acViewNormal

    Set wrd = CreateObject("word.application")
    wrd.Visible = True
    wrd.WindowState = wdWindowStateMaximize

    Set reg2letter = wrd.Documents.Open(filename:="c:\certification\reg ular2.doc")

    With wrd.ActiveDocument.MailMerge
    .Destination = wdSendToPrinter
    .Execute
    End With

    wrd.ActiveDocument.Close (wdDoNotSaveChanges)
    wrd.Quit
    DoCmd.SetWarnings False

    when i run the ".Destination = wdSendToPrinter" it got an error message,
    the requested object didn't find.

    I don't know what the problem is, but i have to fix this problem.
    I want to know where can I find the .destination object, So that i can check the PC whether have that, if not , how can i add it.

    Thanks in advance.

  2. #2
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250
    Does word or Access generate the error? You could put error routines in your code to find out. If it's from word it may be that a (default) printer setting is a muck. Also, try to figure which 'object' is unknown. Is it a word or access object?

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    That is what i want to know. How can i know which error it is. I try to add error description, it just display "Requested object is not found". I believe it is destination object. How can I know it is word or Access generate the error?
    also i check the printer, there has default printer there, if i print a word file, it works. So how can I check what the problem is? Thanks again!

  4. #4
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250
    in your subprocedure where your above code lies put this:
    Private Sub Mycode
    Dim a as string
    On Error GoTo Err_Mycode_Click
    (Stick your code here as above)
    Exit_Mycode_Click:
    Exit Sub

    Err_Mycode_Click:
    MsgBox "Error #:" & Err.Number & " -- " & Err.Description
    a = MsgBox("In Access my code", vbOKOnly)
    Resume Exit_Mycode_Click

  5. #5
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    I am not an expert by all means, i just want to give my two cents. but after you do whatever, you say open Regular2.doc...maybe the error is your computer cannot find that doc.

  6. #6
    Join Date
    Mar 2004
    Posts
    660

    "Runtime error 5852, Requested object is not available"

    the regualr2.doc can be found in the direction.
    The error message is :

    "Runtime error 5852, Requested object is not available"

    Can you figure out for me. I really appreciate.

  7. #7
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    try google "error 5852"
    first hit is: this

    looks like it's a word error.

    izy
    currently using SS 2008R2

  8. #8
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    I remember this guys posting the same error before. He also checked that both access and word are of the same version. I would suggest adding a msword reference and then use the object broweser to see if this object exisits or not. If does then we'll think of something else.

  9. #9
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    I hope someone will come up with a good answer

  10. #10
    Join Date
    Mar 2004
    Posts
    660
    Hi, kan, i did post before, i am still have to figure out this. Couldy you please tell me more detail about how to add msword reference? It sounds good idea.
    Also i really don't know where the object is. where can i find it, and how to add it. Thanks again. I have to figure it out as soon as possible.

  11. #11
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    Open up a module and then under Tools --> references.

  12. #12
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    Try this piece of code

    Public Sub PrintLergeDoc()

    Dim wrd as word.Application
    Dim MyMerge as Word.MailMerge

    Set wrd = Word.Application
    wrd.visible=True

    wrd.Document.Open FileName:="<Your File Name>"
    Set MyMerge=wrd.ActiveDocument.MailMerge

    If MyMerge.State=wdMainAndDataSource Then
    With MyMerge
    .DataSource.FirstRecord=1
    .DateSource.LastRecord=2
    .Destination=wdSendToPrinter
    .Execute
    End With

    Do while erd.BackgroundPrintingStatus <>0
    DoEvents
    loop
    Endif

    wrd.ActiveDocument.Close
    wrd.Quit

    End Sub

Posting Permissions

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