|
-
Sep 28th, 2000, 04:00 AM
#1
Thread Starter
Addicted Member
Hi all,
Does anybody know how to format the autonumber of a field in Access?
What I want is a 5 digit Autonumber, whenever I select autonumber as the field datatype it always shows the actual number i.e. number 6 is 6....
I want 00006
Is that possible
Thanks for any help
Steve
-
Sep 28th, 2000, 04:58 AM
#2
Fanatic Member
Yes...
You can't change the autonumber format in the table itself but you can format the way it's displayed on a form or in a report.
In both Visual Basic and VBA there is a Format function that can be used to pad out a number with a specified number of zeros.
In Access form design there is a 'Format' property of a text box which, with the value '00000' will pad out your number so that five digits are always displayed.
Is this any help?
-
Sep 28th, 2000, 05:18 AM
#3
Thread Starter
Addicted Member
Thats great but what about .....
Yeah I understand that, but my textbox is in my VB application and it is bound to the field in Access.
In access it looks fine, but that formatting is not carried into my VB application. Which makes me thing why bother unless using VBA within Access?? (Maybe another question there)
And another here, What event would I place the Format code into....The form load
Cheers
steve
-
Sep 28th, 2000, 05:25 AM
#4
Fanatic Member
You could try...
The 'DataFormat' property on a VB text box.
Go to the 'Custom' option and try putting in five zero's there.
-
Sep 28th, 2000, 05:59 AM
#5
Thread Starter
Addicted Member
Not there !!
I can't find the Dataformat property, maybe its because I am using VB5....
Steve
-
Sep 28th, 2000, 06:06 AM
#6
Thread Starter
Addicted Member
Ok, A workaround
Thanks for all the help simonm...
I just used this in the end
Code:
Private Sub TxtFields_Change(Index as integer)
me.txtfields(0).Text = Format(Me.txtfields(0).text,"00000")
End sub
Cheers
Steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|