Solved

error 4605

Posted on 2014-02-13
5
531 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 8

Expert Comment

by:TheNautican
ID: 39857330
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
ID: 39857331
Which version office do you have ?
is the word file opened readonly ?
0
 
LVL 16

Author Comment

by:Sheils
ID: 39857442
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
ID: 39865892
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
ID: 39866669
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

630 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