Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Mar 2005
    Leicestershire, United Kingdom
    Thanked 0 Times in 0 Posts

    I have been re-jigging our vba code and have come up against this problem:

    Error 3113 Cannot update as field no updateable.

    The vba is:
    Dim strletterpath As String
    Dim strletterfile As String
    Dim strworddoc As String
    Dim objWord As Word.Application
    Dim objletter As Word.Document
    Dim dbs As DAO.Database
    Dim qdf As DAO.QueryDef
    Dim strSQL As String
    Dim intEnd As Integer
    Dim varsalesid As Variant
    Dim varoffice As Variant
    Dim strlogon As String
    Dim cnn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Dim varofficebased As Variable
    Dim ol As New Outlook.Application
    Dim ns As Outlook.NameSpace
    Dim newMail As Outlook.MailItem
    Dim varAddress
    strlogon = Environ("Username")
    strletterpath = DLookup("tblSalesMan![LetterPath]", "tblsalesman", "Winlogon=" & Chr(34) & strlogon & Chr(34))
    varHipRecDate = DLookup("[HipRecDate]", "tblProperty", "PropertyID=" & Me.PROPERTYID)
    strletterfile = "qry2000.txt"
    strworddoc = "1056.doc"
    'On Error GoTo NoMergeError
    'Open Query add Property Condition and then run export
    Set dbs = CurrentDb
    Set qdf = dbs.QueryDefs("qry2000")
    strSQL = qdf.SQL
    'lose last character
    'Find position of ;
    intEnd = InStr(strSQL, ";")
    strSQL = Left(strSQL, intEnd - 1)
    Set qdf = Nothing
    'add property condition current one one
    strSQL = strSQL & "  where OffersID= " & OffersID
    'Delete old export query and make new one
    'On Error Resume Next
    dbs.QueryDefs.Delete "qry2000Export"
    'On Error GoTo NoMergeError
    dbs.CreateQueryDef "qry2000Export", strSQL
    Set qdf = Nothing
    Set dbs = Nothing
    'Now export as text file
    DoCmd.SetWarnings False
    DoCmd.TransferText ExportDelim, , "qry2000Export", strletterpath & strletterfile, True
    DoCmd.SetWarnings True
    'Because we are using a query with NO Form parameters we could have used the query
    'directly with ODBC
    'Open Word
    Set objWord = New Word.Application
    'Letter document would be open
    Set objletter = objWord.Documents.Open(strletterpath & strworddoc)
    objletter.MailMerge.OpenDataSource (strletterpath & strletterfile)
    objletter.MailMerge.Destination = wdSendToPrinter 'normally print
    'not normally here
    'objWord.Visible = True
    'tidy up
    objletter.Close False 'close without saving
    objWord.Quit False
    'Tidy PC memory
    Set objletter = Nothing
    Set objWord = Nothing
    msgbox "Sales Memo Letters Printed"
    Do not know why this is happening/
    Best Regards,


  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Mt Macedon, Victoria, Australia
    Thanked 45 Times in 44 Posts
    Do you know what line of code is generating the error?

Posting Permissions

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