Permission Denied in Document Designer thru Data Dynamics using VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • preetishrivastava1984
    New Member
    • Oct 2007
    • 6

    Permission Denied in Document Designer thru Data Dynamics using VB

    Hi All,
    I am using Data Dynamics for Document Designer using VB. The code works fine at design mode but when I try to compile it , an error occurs (Permission Denied) at rpt.LoadLayout.
    Can anybody plzz help me.
    Below is my code.


    Private Sub showDynamicRptP O(rptTyp As Integer, opt As String)

    Dim xdoc As DOMDocument
    Dim elem As IXMLDOMElement
    Dim xNodeList As IXMLDOMNodeList
    Dim i As Integer
    Dim rsReadDynRpt As New ADODB.Recordset
    Dim rpt As New DDActiveReports 2.ActiveReport
    Dim strRptPath As String
    Dim sql As String
    Dim strCol As String

    With rsReadDynRpt
    .open "select * from dynamicReport where Activated=true and RptType=" & rptTyp, con, adOpenDynamic, adLockOptimisti c
    If Not .BOF And Not .EOF Then
    strRptPath = .Fields("RptPat h")


    sql = "SELECT OdetSlNo as Slno, ProductName,"
    strCol = "OdetQty"
    For i = 1 To intTOTCOLS
    sql = sql & CStr(strCol & i) & " as Qty" & i & ", "
    Next
    sql = sql & "TotQty1 as Qty"
    sql = sql & ",CStr(Format(O detRate, '0.00')) As Rate, CStr(Format(Ode tLength,'0.00') ) as Length1, ProductType, "
    sql = sql & "cstr(Format(Am t,'0.00')) as Amount "
    sql = sql & "FROM qryPODetProd WHERE OdetOrdrNo = " & lngPurOrderNo
    sql = sql & " Order By OdetSlNo"

    Set xdoc = New DOMDocument

    Set xNodeList =doc.selectNode s("//ActiveReportsLa yout/Sections/Section/Control")
    For i = 0 To xNodeList.Lengt h - 1
    Set elem = xNodeList.Item( i)
    If elem.getAttribu te("Name") = "dcDetail" Then
    elem.setAttribu te "RecordSour ce", sql
    End If
    Select Case elem.getAttribu te("Name")
    Case "CompanyNam e":
    elem.setAttribu te "Text", strCompName
    Case "Address1":
    elem.setAttribu te "Text", strCompAddr1
    Case "Address2":
    elem.setAttribu te "Text", strCompaddr2

    and other cases

    End Select
    Next
    xdoc.Save strRptPath

    '
    rpt.LoadLayout strRptPath

    rpt.ResetScript s
    rpt.ScriptDebug gerEnabled = True
    rpt.Restart

    rpt.Run False
    If opt = "VIEW" Then
    Set frmDocDesignPre view.arv.Report Source = rpt
    frmDocDesignPre view.show
    ElseIf opt = "PRINT" Then
    rpt.printReport True
    End If
    End If
    End With
    Set rsReadDynRpt = Nothing
    Screen.MousePoi nter = vbNormal


    End Sub
Working...