Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Record Change (VB6)

    Although my application is working as I expect it to, on the odd occurance, I get a change in record for no apparent reason.
    I pull images from a fso folder according to a 5 digit reference I add to an unbound text.
    Using the text, in this example I enter 17489 as a reference, but the application is pulling an image which is 17365.
    17365 has many photo's but the application strangely only shows 1.
    At this moment in time there are no images for 17489 so no images should be shown.
    I stepped thru the code to see if I can trap why this was happening but nothing is obvious.
    17489 suddenly changes to 17365 in the code "strFile"

    Does anyone have any ideas ?

    <pre>'Imaging
    Private Sub cmdList_Click()
    Dim fso As Object
    Set fso = CreateObject("scripting.FileSystemObject")

    'FetchPDF
    imgDel
    If Me.txtEst = "" Or Me.txtEst = "*" Then
    MsgBox "You Must Enter A Reference No.", , "Information"
    Me.AcrobatPath = "L:MMPDFESTpdfImageViewer.pdf"
    Me.Pdf1.LoadFile Me.AcrobatPath
    imgDel
    'Me.lstImages.Clear
    Exit Sub
    End If

    Dim i As Integer
    Dim strFile As String
    ' strLeft5 to find left most 5 characters for frmDetails
    Dim strLeft5 As String
    ' Fixed folder
    strFolder = "L:MMPDFIMAGE"
    FetchPDF
    ' Get Left5
    strLeft5 = Left(Me.txtEst, 5)

    i = 0
    ' Get jpg files in strFolder whose names begin with strLeft5
    strFile = Dir(strFolder & "" & strLeft5 & "*.jpg")

    ' Loop through files
    Do While strFile <> "" And i < 127

    i = i + 1
    'arrFileNames(i) = strFile
    arrFileNames(i, 1) = strFile
    arrFileNames(i, 2) = Format(fso.GetFile(strFolder & "" & strFile).DateCreated, "dd/mm/yy")

    strFile = Dir
    Loop
    intFileCount = i

    If intFileCount = 0 Then
    Exit Sub
    End If

    If intFileCount < MaxNumberOfImages Then
    intNumberOfImages = intFileCount
    Else
    intNumberOfImages = MaxNumberOfImages
    End If

    If intNumberOfImages > 0 Then
    FillImages 1
    End If
    Set fso = Nothing
    End Sub</pre>


  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Record Change (VB6)

    For what its worth, it seems this problem only occurs when there is a long file name.
    I recently changed the format of the images to increment upon export keeping within 8 characters.
    This particular example as above, I changed the filenames to 17365-01 17365-02 etc, and 17489 doesn't pull the single image anymore.

    Unless someone can see anything obscure, If I let the number format continue, the problem should eradicate it'self in time.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Record Change (VB6)

    I don't see anything in your code that would cause the problem. But if using short file names seems to cure it, could you change the "old" file names retroactively?

  4. #4
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Record Change (VB6)

    Phew !!!!!!!!

    There's far too many images now.
    I'll let them run out, it doesn't cause too much of a problem.
    Thanks for checking the code anyway.

Posting Permissions

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