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

    Save Suggestions (VB6)

    After a successful demonstration last night of my PDF & Image Viewing software to my peers, I have been asked a couple of questions.


    We save our images via an input box using the estimate number to rename them.
    This way, they can be easily retrieved at a later date.

    The head office however, is a much larger concern and the amount of time waster estimates created is immense.
    They will not create an estimate number until it is actually required.

    In this scenario, they want to save the image temporarily, and if an estimate number is later created, then assign the number to the images.
    The only way they can do this initially, is by saving under the vehicle registration.
    Although this can already be done, I am afraid of the clutter that will be created and never be retrieved if the job is never converted.

    There will eventually be images in the working folder with any number of registration variations mixed in with correctly named numeric files.

    My thoughts at the moment are, if the export code recognised that the estimate number enterred in the input box was not completely numeric
    ie KW51OFR or G787EED, then the code would put the images into a "TempImage" folder for retrieval later.

    This way, the working folder would not hold clutter and the temp folder be better administered later.

    What do you think ? would the Instr$ function be the best way to do this ?

    TEST:
    <pre> If InStr(JN, 5) Is Numeric Then
    MsgBox "Number"
    Else
    MsgBox "Letter"
    End If</pre>


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

    Re: Save Suggestions (VB6)

    There is a VB/VBA function IsNumeric. It takes an expression (string or number) as argument, and returns True if the expression is recognized as numeric, false otherwise.

    ? IsNumeric("123")
    True

    ? IsNumeric("K123D")
    False

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

    Re: Save Suggestions (VB6)

    Hans
    Not sure if I understand that !

    <pre> Private Function chkJN(JN as string)
    Dim strTemp as String

    strTemp = Mid(JN,1, Instr(1,JN "."))

    If (Not IsNumeric(strTemp)) Then
    MsgBox "This Is A Letter Character Within The File Name"</pre>


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

    Re: Save Suggestions (VB6)

    Dave,

    What is the problem or question?

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

    Re: Save Suggestions (VB6)

    Hans
    Sometimes we have walk in enquiries.
    When the estimator goes with the client to look at his damaged car, he takes his camera along with his estimate sheet.

    Sometimes the client is a time waster and the estimate is not put onto computer at this stage.
    We still need to save the images but under Registration instead of Estimate Number ie: W228PPR

    I need the function to check if this value contains all numeric or some letters.
    The easiest way I can Explain this is :

    If JN contains any letters then save to folder A
    else
    Save to folder B

    Later, if the estimate is put on the system and an Estimate Number allocated, the images can be pulled from the temp folder and exported
    to the working folder with the new name.
    The current already handles this, ie, 12345-01, 12345-02 etc.

    So the question is how to check within the string for letter characters.

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

    Re: Save Suggestions (VB6)

    Hans

    Didn't realise this was so easy :

    <pre> If IsNumeric(JN) Then 'Check If Estimate Number or Registration
    '================================================= =========
    'Do the stuff
    ' Determine maximum sequence number used up to now
    intMax = 0
    DP = "L:MMPDFImage"
    FN = Dir(DP & JN & "-??.jpg")
    Do Until FN = ""
    intPos = InStr(FN, ".")
    If intPos > 0 Then
    intSeq = Val(Mid(FN, intPos - 2, 2))
    If intSeq > intMax Then
    intMax = intSeq
    End If
    End If
    FN = Dir
    Loop
    ' Now loop through the items of the list box
    For N = 0 To lstImages.ListCount - 1
    If lstImages.Selected(N) Then
    ' Increase the sequence number for the next file
    intMax = intMax + 1
    FF = JN & "-" & Format(intMax, "00") & ".jpg"
    FileCopy lstImages.List(N), DP & FF

    End If
    Next N
    Else
    '================================================= =========
    'Do the stuff
    ' Determine maximum sequence number used up to now
    intMax = 0
    TP = "L:MMPDFTempImg"
    FN = Dir(TP & JN & "-??.jpg")
    Do Until FN = ""
    intPos = InStr(FN, ".")
    If intPos > 0 Then
    intSeq = Val(Mid(FN, intPos - 2, 2))
    If intSeq > intMax Then
    intMax = intSeq
    End If
    End If
    FN = Dir
    Loop
    ' Now loop through the items of the list box
    For N = 0 To lstImages.ListCount - 1
    If lstImages.Selected(N) Then
    ' Increase the sequence number for the next file
    intMax = intMax + 1
    FF = JN & "-" & Format(intMax, "00") & ".jpg"
    FileCopy lstImages.List(N), TP & FF

    End If
    Next N
    End If</pre>


Posting Permissions

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