Handling Version Numbers (Major.Minor.Build.Plateform)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Birky
    New Member
    • Dec 2006
    • 52

    Handling Version Numbers (Major.Minor.Build.Plateform)

    Can someone point me in the right direction on how to use Version Numbers within Access? I have a database were its primary goal is to track the versions of several projects. Since the version numbers are formatted as Major.Minor.Bui ld.Plateform (1.01.01.01) I am unable to find a way to sort and or automatically update the version to the next appropriate version number. I was hoping someone could point me to some literature on best practices on how to deal with these types of numbers within Access.

    Any help would be greatly appreciated.

    Thanks
    Birky
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by Birky
    Can someone point me in the right direction on how to use Version Numbers within Access? I have a database were its primary goal is to track the versions of several projects. Since the version numbers are formatted as Major.Minor.Bui ld.Plateform (1.01.01.01) I am unable to find a way to sort and or automatically update the version to the next appropriate version number. I was hoping someone could point me to some literature on best practices on how to deal with these types of numbers within Access.

    Any help would be greatly appreciated.

    Thanks
    Birky
    This would be the general idea:
    [CODE=vb]
    Dim strVerNumber As String
    Dim strNewVerNumber As String

    'Retrieve the last Version Number for a specific ProjectID (1.01.01.01)
    strVerNumber = DLast("[Version]", "tblVersionNumb ers","[ProjectID] = " & <Project ID>)

    'Let's say you wanted to increment the Minor Version Number (Major Version between 1 and 9)
    strNewVerNumber = Left$(strVerNum ber, 2) & Format$(Val(Mid $(strVerNumber, 3, 2)) + 1, "00") & _
    Right$(strVerNu mber, 6)

    Debug.Print strNewVerNumber[/CODE]
    OUTPUT:
    [CODE=text]1.02.01.01[/CODE]

    Comment

    • Birky
      New Member
      • Dec 2006
      • 52

      #3
      Originally posted by ADezii
      This would be the general idea:
      [CODE=vb]
      Dim strVerNumber As String
      Dim strNewVerNumber As String

      'Retrieve the last Version Number for a specific ProjectID (1.01.01.01)
      strVerNumber = DLast("[Version]", "tblVersionNumb ers","[ProjectID] = " & <Project ID>)

      'Let's say you wanted to increment the Minor Version Number (Major Version between 1 and 9)
      strNewVerNumber = Left$(strVerNum ber, 2) & Format$(Val(Mid $(strVerNumber, 3, 2)) + 1, "00") & _
      Right$(strVerNu mber, 6)

      Debug.Print strNewVerNumber[/CODE]
      OUTPUT:
      [CODE=text]1.02.01.01[/CODE]

      Thanks for the information but I was able to extract the needed information by using the below code.

      Code:
          Dim i As Integer
          
          output_prefixStr = ""
          output_suffixStr = ""
          
          If Not IsNull(input_inStr) Then
              ' inStr has something, so parse it
              If InStr(1, input_inStr, ".", vbTextCompare) = 0 Then
                  ' inStr has no dot, so suffix=inStr, and we're done
                  output_suffixStr = input_inStr
              Else
                  ' inStr has at least one dot, so find position of rightmost dot
                  i = Len(input_inStr)
                  While InStr(i, input_inStr, ".") = 0 And i > 0
                      i = i - 1
                  Wend
                  ' set prefixStr as all text left of dot, and suffixStr as all text right of dot
                  output_prefixStr = Left(input_inStr, i - 1)
                  output_suffixStr = Right(input_inStr, Len(input_inStr) - i)
              End If
          End If
      Thanks again
      Birky

      Comment

      Working...