Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How do I convert double to string?

Avatar of cklosko
cklosko asked on
Microsoft Access
5 Comments1 Solution1185 ViewsLast Modified:
I need to auto populate an Id field with 999999991, then 999999992, etc. when an Id is not entered by the user. The Id is text, since the user wants to use a leading 0 in the Id, such as 043-432-098. So, I am converting the text to a double, so as to be able to add 1 (when I used int, I got an overflow error). Then, I need to convert this new number, 999999992, for example, back to a text string. My code looks, as follows:
Dim MaxForcedANumber As String
Dim ANumberDbl As Double

'If ANumber was not entered, force 99999999x
If IsNull(Me.ANumber) = True Then
  'Search for largest A Number in database (forced A Numbers are largest)
  MaxForcedANumber = DMax("ANumber", "tbl_AllClients")
  ANumberDbl = CDbl(MaxForcedANumber) + 1
  Me.ANumber = Mid(ANumberDbl, 1, 3) & "-" & Mid(ANumberDbl, 4, 3) & "-" & Mid(ANumberDbl, 7, 3)
 End If
I get a type mismatch error. What is incorrect?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers