Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Unanswered: Access 2003 Error "Invalid Use Of Null"

    Where is the null error?
    The highlighted line in the debuggers is the line that starts with photocount =

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    
    Dim i As Integer, photocount As Integer
    Dim strImage As String, strPath As String, mlsno As String
    
    ' set count of number of photos
    photocount = IIf([TotalPhotoCount] > 9, 9, [TotalPhotoCount]) (error highlights this line)
    mlsno = [ListingID]
    
    ' load images from disk
    For i = 1 To photocount
        strImage = "imgPicture" & i
        strPath = "f:\mlspresentationdata\Photo" & mlsno & "-" & i & ".jpg"
        If Dir(strPath) <> "" Then
            Me.Controls(strImage).Picture = strPath
            Me.Controls(strImage).Visible = True
        Else
            Me.Controls(strImage).Visible = False
        End If
    Next
    
    ' make remining images invisible
    For i = photocount + 1 To 9
        strImage = "imgPicture" & i
        Me.Controls(strImage).Visible = False
    Next
    
    EndSub

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'd wager that TotalPhotoCount is NULL when that line gets evaluated.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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