By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,600 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,600 IT Pros & Developers. It's quick & easy.

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

P: 52
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.Build.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
Apr 2 '08 #1
Share this Question
Share on Google+
2 Replies


ADezii
Expert 5K+
P: 8,619
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.Build.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:
Expand|Select|Wrap|Line Numbers
  1. Dim strVerNumber As String
  2. Dim strNewVerNumber As String
  3.  
  4. 'Retrieve the last Version Number for a specific ProjectID (1.01.01.01)
  5. strVerNumber = DLast("[Version]", "tblVersionNumbers","[ProjectID] = " & <Project ID>)
  6.  
  7. 'Let's say you wanted to increment the Minor Version Number (Major Version between 1 and 9)
  8. strNewVerNumber = Left$(strVerNumber, 2) & Format$(Val(Mid$(strVerNumber, 3, 2)) + 1, "00") & _
  9.                   Right$(strVerNumber, 6)
  10.  
  11. Debug.Print strNewVerNumber
OUTPUT:
Expand|Select|Wrap|Line Numbers
  1. 1.02.01.01
Apr 6 '08 #2

P: 52
This would be the general idea:
Expand|Select|Wrap|Line Numbers
  1. Dim strVerNumber As String
  2. Dim strNewVerNumber As String
  3.  
  4. 'Retrieve the last Version Number for a specific ProjectID (1.01.01.01)
  5. strVerNumber = DLast("[Version]", "tblVersionNumbers","[ProjectID] = " & <Project ID>)
  6.  
  7. 'Let's say you wanted to increment the Minor Version Number (Major Version between 1 and 9)
  8. strNewVerNumber = Left$(strVerNumber, 2) & Format$(Val(Mid$(strVerNumber, 3, 2)) + 1, "00") & _
  9.                   Right$(strVerNumber, 6)
  10.  
  11. Debug.Print strNewVerNumber
OUTPUT:
Expand|Select|Wrap|Line Numbers
  1. 1.02.01.01

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

Expand|Select|Wrap|Line Numbers
  1.     Dim i As Integer
  2.  
  3.     output_prefixStr = ""
  4.     output_suffixStr = ""
  5.  
  6.     If Not IsNull(input_inStr) Then
  7.         ' inStr has something, so parse it
  8.         If InStr(1, input_inStr, ".", vbTextCompare) = 0 Then
  9.             ' inStr has no dot, so suffix=inStr, and we're done
  10.             output_suffixStr = input_inStr
  11.         Else
  12.             ' inStr has at least one dot, so find position of rightmost dot
  13.             i = Len(input_inStr)
  14.             While InStr(i, input_inStr, ".") = 0 And i > 0
  15.                 i = i - 1
  16.             Wend
  17.             ' set prefixStr as all text left of dot, and suffixStr as all text right of dot
  18.             output_prefixStr = Left(input_inStr, i - 1)
  19.             output_suffixStr = Right(input_inStr, Len(input_inStr) - i)
  20.         End If
  21.     End If
Thanks again
Birky
Apr 11 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.