Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

error 4605

Posted on 2014-02-13
5
Medium Priority
?
544 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
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 1500 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

885 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