none
runtime error 2448: you can't assign a value to this object. access

    Question

  • I have an access database used by multi users. The users are using two different names of drives (mapped networks like k and R) the users who using k drive have received an error "runtime error 2448: you can't assign a value to this object" This error is received by very rarely and disappeared on the next day. The time being the users are few times logged out and logged in to the database to solve the problem. Version info: Access 2003 and Windows XP Professional.
    I don't know why it is happened and how to solve the problem. The problem is appeared in one the form tab when clicking the button.
    Please see the following code.

    ---------------------------------------------------------------
    Private Sub cmdDoClientSlip_Click()
      Dim strReportName As String
      Dim strRecordSource As String
      Dim blnDoFax As Boolean
      Dim blnPrintExtension As Boolean
      Dim vSelectedExtnID As Variant
      Dim strErrMsg As String
      Dim tbTextboxTime As access.TextBox
      Dim tbTextboxCount As access.TextBox
     
      blnPrintExtension = Me.chkPrintExtension.value
      blnDoFax = Me.chkApp_Confirm_DoFax.value
     
      strReportName = "rptClientConfirmationWithSig"
      strRecordSource = IIf(blnPrintExtension, "_qrptClientConfirmationExtension", "_qrptClientConfirmation")
      If blnPrintExtension Then
        vSelectedExtnID = Me.txtSelectedExtensionID.value
      Else
        vSelectedExtnID = Null
      End If
      strErrMsg = "Cannot " & IIf(blnDoFax, "fax", "print") & " Client Confirmation Slip"
      Set tbTextboxTime = Me.App_Confirm_Time_Printed_Client
      Set tbTextboxCount = Me.App_Confirm_Count_Printed_Client

      Call printfax_confirmation_slip( _
          p_strReportName:=strReportName _
        , p_strRecordSource:=strRecordSource _
        , p_blnDoFax:=blnDoFax _
        , p_blnPrintExtension:=blnPrintExtension _
        , p_vSelectedExtnID:=vSelectedExtnID _
        , p_strErrMsg:=strErrMsg _
        , p_tbTextboxTime:=tbTextboxTime _
        , p_tbTextboxCount:=tbTextboxCount _
        )
     
    End Sub
    -------------------------------------------------------------------
    Private Sub printfax_confirmation_slip( _
                                          p_strReportName As String _
                                        , p_strRecordSource As String _
                                        , p_blnDoFax As Boolean _
                                        , p_blnPrintExtension As Boolean _
                                        , p_vSelectedExtnID As Variant _
                                        , p_strErrMsg As String _
                                        , Optional p_tbTextboxTime As access.TextBox = Nothing _
                                        , Optional p_tbTextboxCount As access.TextBox = Nothing _
                                        )
    '--
    '-- sanity check: the current record must be an Approved Application
        Dim msg As String
        Dim strAction As String
        Dim errNum As Long
        Dim errDesc As String
       
    inits:
        strAction = VBA.IIf(p_blnDoFax, "fax", "print")
       
        Select Case True
          Case Me.App_EnqOnly.value = True
              msg = "ERROR: cannot " & strAction & " an ENQUIRY"
          Case Me.App_Outcome_Status <> "A"
              msg = "ERROR: can ONLY " & strAction & " an APPROVED application"
          Case Else
              msg = ""
        End Select
       
        If msg <> "" Then
            Call VBA.MsgBox(msg, vbOKOnly, p_strErrMsg)
            GoTo cleanup
        End If
       
        '-- must open application in EDIT mode, since we must pass this print/fax directive
        '-- to the Report via the database table
        If Me.App_Confirm_DoFax.value <> p_blnDoFax Then
            Me.App_Confirm_DoFax.value = p_blnDoFax
        End If
       
        '-- keep count of #times printed
        If p_tbTextboxCount Is Nothing Then
            '-- don't keep stats
        Else
            p_tbTextboxCount.value = p_tbTextboxCount.value + 1
        End If
       
        If p_tbTextboxTime Is Nothing Then
            '-- don't keep stats
        Else
            p_tbTextboxTime.value = VBA.Now()
        End If
       
        '-- save current record first
        If Me.Dirty = True Then Call cmdSaveRecord_Click
       
    work:
    On Error GoTo handle
       
        Dim strWhere As String
        Dim rpt As Report
        Dim strArgs As String
       
        If p_blnPrintExtension = True Then
            '-- print a similar report bound to a different datasource
            If VBA.IsNull(p_vSelectedExtnID) = True Then
                msg = "ERROR: must select an EXTENSION before printing it"
                Call VBA.MsgBox(msg, vbOKOnly, "Print/Fax Confirmation Slip")
                GoTo cleanup
            Else
                strWhere = "[Extn_ID] = " & p_vSelectedExtnID
            End If
        Else
            '-- NOTE: App_ID here is a CONTROL name on the report, not table field name!
            strWhere = "[App_ID] = " & Me.txtApp_ID.value
        End If
       
        If Len(p_strRecordSource) > 0 Then
          strArgs = p_strRecordSource & ";" & strWhere
          Call Application.DoCmd.OpenReport( _
                    ReportName:=p_strReportName _
                  , View:=acViewPreview _
                  , OpenArgs:=strArgs _
                  )
        Else
          Call Application.DoCmd.OpenReport( _
                    ReportName:=p_strReportName _
                  , View:=acViewPreview _
                  , Wherecondition:=strWhere _
                  )
        End If
       
    cleanup:
        Exit Sub

    handle:
        MsgBox err.Description
        Resume cleanup
    End Sub

    Thanks for your help

    Thursday, October 29, 2009 12:45 AM