Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Provided Answers: 5

    Unanswered: Runtime error 13 on passing variable

    OK guys not as easy as you thought it would be

    I have a function called '(go to "continue here to see the rest of question")

    Sub SetReportImagePath(rpt As Report) ', Optional lRPT_ID As Long)
    On Error GoTo Err_SetReportImagepath

    Dim lReportID As Long, intHeight As Integer, intWidth As Integer
    Dim tblReportImages As DAO.Recordset
    Dim sCtrlName As String
    Dim sImageFile As String
    Dim spath As String
    Dim sPFN As String
    Dim ssql As String
    Dim RPTCTL As String
    lReportID = GetReportID(rpt.Name)

    ssql = "SELECT ReportImages.CtrlName, ReportImages.ImageFile, ReportImages.ReportTemplateID "
    ssql = ssql & "FROM ReportImages "
    ssql = ssql & "WHERE (((ReportImages.ReportTemplateID)=" & lReportID & "));"

    Set tblReportImages = CurrentDb.OpenRecordset(ssql, dbOpenDynaset, dbSeeChanges)

    spath = sImagePath

    With tblReportImages
    If Not .EOF Then
    While Not .EOF
    sCtrlName = !CtrlName
    sImageFile = !ImageFile
    sPFN = spath & sImageFile
    If Not FileExists(sPFN) Then
    MsgBox "The image file for your report cannot be found." & vbCrLf & "Your report will be displayed without the logo. Please contact your Epoch Administrator to check your data folder.", vbOKOnly + vbExclamation, "Unable To Display Image On Report."
    rpt.Controls(sCtrlName).Picture = sPFN
    ' intHeight = nz(DLookup("[IMAGEHEIGHT]", "REPORTIMAGESETUP"), 0)
    ' intWidth = nz(DLookup("[IMAGEWIDTH]", "REPORTIMAGESETUP"), 0)
    ' If intHeight >= intWidth Then
    ' rpt.Controls(sCtrlName).Height = 864
    ' rpt.Controls(sCtrlName).Width = 864
    ' ElseIf intHeight < intWidth Then
    ' rpt.Controls(sCtrlName).Height = 1008
    ' rpt.Controls(sCtrlName).Width = 2880
    ' End If

    End If
    End If
    End With
    Exit Sub
    Call FatalError(Err.Number, Err.Description, "ReportLayoutCode", "SetReportImagePath")
    Resume Exit_Err_SetReportImagepath
    Resume Next
    End Sub

    continue here:
    I call that function from another procedure from within a procedure c

    Sub openreports(rpt As Report)

    inside this procedure is where I call the function:
    SetReportImagePath (rpt)

    and it is here that I get the runtime 13

    any ideas why I get this and why the code compiles without error
    Dale Houston, TX

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    That's a type mismatch.

    What line throws the error? Have you set a breakpoint and examined the value of whatever arguments you're providing at runtime?

    VBA plays fast and loose with types right up to run time.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    Quote Originally Posted by Teddy View Post
    VBA plays fast and loose with types right up to run time.
    Laughed out loud at that one!

  4. #4
    Join Date
    May 2003
    Provided Answers: 5
    took the () from around the rpt and it ran fine
    SetReportImagePath (rpt)
    Dale Houston, TX

Posting Permissions

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