How to make the number 1 be the number 000001 in table

NateofMT

New Member
Joined
Jul 11, 2002
Messages
13
Here is what I am trying to do. I have a field that generates its own number with the following code:

Me.Job_Number.Value = Nz(DMax("[Job_Number]", "Job_Table"), 0) + 1

I need it to change it to 00000x. Can I do this in the table design? Or where else?

If it was a text string, this is how I would do it:

If Len(Me.Job_Number.Value) < 6 Then
For numberofzeroes = 1 To (6 - Len(Me.Job_Number.Value))
Me.Job_Number.Value = "0" & Me.Job_Number.Vertical
Next numberofzeroes
end if

But since it is a numeric, I am lost.

Thanks,
Nathan
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
In your table set format property of the Job_Number field to 00000 or however many zeroes you need.

Note though this formatting won't be carried over to any forms/reports already created.
 
Upvote 0

Forum statistics

Threads
1,221,780
Messages
6,161,887
Members
451,730
Latest member
BudgetGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top