Hi Steve and Everyone,
How is everyone doing? I still need some help with a problem.
I am having a problem with the tenth decimal numbers such as 0.1 and 0.10, 0.2 and 0.20, ...
For this reason, I can get up to number 9.9, then the next number is back to 2 again.
When I reach to 9.9, my DecPortion is 0.9 and DecIncrease is 0.9. Then the next number is 2 because the
DecPortion is 1 and DecIncrease is 1.1. Is there a function or a way to take care
of this problem. Please help. Thanks a lot. Below is the function:
Function NextID()
Dim vNextID As Double
Dim vIncrement As Double
Dim rs As New ADODB.Recordset
Dim db As New ADODB.Connection
Set rs = New ADODB.Recordset
rs.Open "Select * From tblNextID", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs.MoveFirst
NextID = rs("NextID"
vNextID = rs("NextID"
+ 1
If vNextID >= 1000 Then
vNextID = 1 + (rs("DecPortion"
+ 0.1)
vIncrement = 0.1
rs("DecPortion"
= rs("DecPortion"
+ 0.1
End If
rs("NextID"
= vNextID
rs("DecIncrement"
= rs("DecPortion"
+ vIncrement
rs.Update
rs.Close
End Function
How is everyone doing? I still need some help with a problem.
I am having a problem with the tenth decimal numbers such as 0.1 and 0.10, 0.2 and 0.20, ...
For this reason, I can get up to number 9.9, then the next number is back to 2 again.
When I reach to 9.9, my DecPortion is 0.9 and DecIncrease is 0.9. Then the next number is 2 because the
DecPortion is 1 and DecIncrease is 1.1. Is there a function or a way to take care
of this problem. Please help. Thanks a lot. Below is the function:
Function NextID()
Dim vNextID As Double
Dim vIncrement As Double
Dim rs As New ADODB.Recordset
Dim db As New ADODB.Connection
Set rs = New ADODB.Recordset
rs.Open "Select * From tblNextID", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs.MoveFirst
NextID = rs("NextID"
vNextID = rs("NextID"
If vNextID >= 1000 Then
vNextID = 1 + (rs("DecPortion"
vIncrement = 0.1
rs("DecPortion"
End If
rs("NextID"
rs("DecIncrement"
rs.Update
rs.Close
End Function