Solved

error 4605

Posted on 2014-02-13
5
506 Views
Last Modified: 2014-03-06
When I run the procedures attached below I get the following error:-
error 4605 this method or procedure is not available because some or all of the object does not refer to a table

The error general occur when there is more than 8 rows required in the table. However, when I run it in debug mode it generate every row without any problem. I also tried it on a computer at work and it worked fine. Think that it may have something to do with my computer speed I will also provide its spec: -Windows 7 Ultimate Processor: Intel(R) Core(TM)i5-3470 CPU @ 3.20Hz 3.20Hz, Installed memory(RAM)8GB (7.70 GB usable), 64-bit Operating system.

The code that I am trying to run is as follows:
Public Function InsertSingleConsignementInfo(lngConsignmentID As Long, lngMovementID As Long)

'Insert single merge field
'-------------------------

'Consignee
lngEntityNameID = DLookup("fldconsigneeid", "tblConsignments", "fldconsignmentid=" & lngConsignmentID)
strConsignee = Nz(DLookup("fldothernames", "tbl_lkpEntityNames", "fldEntityID=" & lngEntityNameID), "")
strConsignee = strConsignee & " " & Nz(DLookup("fldsurname", "tbl_lkpEntityNames", "fldEntityID=" & lngEntityNameID), "")


objApp.ActiveDocument.Bookmarks("Consignee").Select
objApp.Selection.Text = strConsignee

'Movement

strMovement = DLookup("fldMovementdescription", "qryMovement", "fldMovementid=" & lngMovementID)
objApp.ActiveDocument.Bookmarks("Movement").Select
objApp.Selection.Text = strMovement

'Sender

lngEntityNameID = Nz(DLookup("fldSenderID", "tblConsignments", "fldconsignmentid=" & lngConsignmentID), 0)

If lngEntityNameID <> 0 Then

    strSender = Nz(DLookup("fldothernames", "tbl_lkpEntityNames", "fldEntityID=" & lngConsigneeID), "")
    strSender = strSender & " " & Nz(DLookup("fldsurname", "tbl_lkpEntityNames", "fldEntityID=" & lngConsigneeID), "")
    
    objApp.ActiveDocument.Bookmarks("Sender").Select
    objApp.Selection.Text = strSender

End If
'Merge List of good in the goods table
'-------------------------------------

strSQL = "Select * from TblGoods where fldConsignmentID=" & lngConsignmentID

setADODBReference

Rst.Open strSQL

i = 1

Do Until Rst.EOF
    If i = 1 Then
     
        'Add data to the first row to the table (the "empty" row)
        '--------------------------------------------------------
        'Quantity
        
        strQuantity = Nz(Rst!fldPackaging, "")
        strQuantity = strQuantity & " " & Nz(DLookup("fldUnits", "tbl_lkpUnits", "fldUnitID=" & Nz(Rst!fldPackageUnit, 0)), "")
        
        objApp.ActiveDocument.Bookmarks("Quantity").Select
        objApp.Selection.Text = strQuantity
        
        'Goods
        
        strGoods = Nz(DLookup("fldGoodsType", "tbl_lkpGoodsType", "fldGoodsTypeID=" & Rst!fldGoodsTypeId), "")
        
        objApp.ActiveDocument.Bookmarks("Goods").Select
        objApp.Selection.Text = strGoods
        
        'Length
        
        strLength = Nz(Rst!fldLength, "")
       
        objApp.ActiveDocument.Bookmarks("Length").Select
        objApp.Selection.Text = strLength
        
        
        'Tonnage
        strTonnage = Nz(Rst!fldTonnage, "")
       
        objApp.ActiveDocument.Bookmarks("Tonnage").Select
        objApp.Selection.Text = strTonnage
            
    Else
    
        'Create new row
        objApp.Selection.InsertRowsBelow
        objApp.Selection.MoveUp
        objApp.Selection.MoveDown
         
        'Insert Bookmarks in the new row
        
        AddBookmark "Quantity", i
        AddBookmark "Goods", i
        AddBookmark "Length", i
        AddBookmark "Tonnage", i
   
        'Add data to the new row
        
        'Quantity
        
        strQuantity = Nz(Rst!fldPackaging, "")
        strQuantity = strQuantity & " " & Nz(DLookup("fldUnits", "tbl_lkpUnits", "fldUnitID=" & Nz(Rst!fldPackageUnit, 0)), "")
        
        objApp.ActiveDocument.Bookmarks("Quantity" & i).Select
        objApp.Selection.Text = strQuantity
        
        
        'Goods
        
        strGoods = Nz(DLookup("fldGoodsType", "tbl_lkpGoodsType", "fldGoodsTypeID=" & Nz(Rst!fldGoodsTypeId, 0)), "")
        
        objApp.ActiveDocument.Bookmarks("Goods" & i).Select
        objApp.Selection.Text = strGoods
        
        
        'Length
        
        strLength = Nz(Rst!fldLength, "")
        
        objApp.ActiveDocument.Bookmarks("Length" & i).Select
        objApp.Selection.Text = strLength
        
        'Tonnage
        
        strTonnage = Nz(Rst!fldTonnage, "")
        
        objApp.ActiveDocument.Bookmarks("Tonnage" & i).Select
        objApp.Selection.Text = strTonnage
     
    End If
        
    i = i + 1

    Rst.MoveNext
Loop

Rst.Close

End Function

Private Sub AddBookmark(strBookmark As String, i)

objApp.ActiveDocument.Bookmarks.Add name:=strBookmark & i
objApp.Selection.MoveRight

End Sub

Open in new window


I hope that someone can point me in the right direction
0
Comment
Question by:Sheils
5 Comments
 
LVL 8

Expert Comment

by:TheNautican
Comment Utility
Firstly, I'd hit Alt+F11 and then click Debug then compile <nameofyourdatabase> and see what lines come back bad. If everything makes it past compile, then debug that procedure line at a time and see what pops.

Regards,
-Naut
0
 
LVL 10

Expert Comment

by:Gozreh
Comment Utility
Which version office do you have ?
is the word file opened readonly ?
0
 
LVL 16

Author Comment

by:Sheils
Comment Utility
TheNautican,

It passes compile. Debugging line by line does not pick it up. It generate all the rows and insert the data in the word document as intended. As I mention the error only occurs on my home computer. It works fine on my work computer. Problem is that I am designing it for someone to use on multiple computers so I have to be sure that it will work all the time.

Gozreh

I am using office 2007. Word opens normally as far as I know.
0
 
LVL 12

Accepted Solution

by:
jkaios earned 500 total points
Comment Utility
It works fine on my work computer.

The problem could be simply configuration/security settings in which your home computer might have disabled the feature in Office 2007 while the computer in your office has it enabled.

Or maybe your home computer has not been updated with the latest service pack.

See if this can help:
https://support.microsoft.com/kb/248644

Or this:
http://support.microsoft.com/kb/813983

Or this:
http://answers.microsoft.com/en-us/office/forum/office_2013_release-word/run-time-error-4605-in-word-2013-no-information/1ca02c04-5cea-484e-bd23-f4d18183c1b2
0
 
LVL 16

Author Comment

by:Sheils
Comment Utility
Thank jkois

I will go through the articles that you have proposed and get back later.

I tried the code on a client computer with only 500MB ram and it worked fine. So it is not a memory issue. I am inclined to agree that it is a security issue. But it will be good to find out exactly what so that I am able to fix it if it happens on another computer.

Cheers
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now