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

save number 001 and so on in access database

P: 1
Hi..
I want to save a number like 001 and so on in access database.
I've tried something like this but it didn't work
strSQL = "Insert into [User] (UserID) VALUES" & "(" & Format(strNewID, "0##") & ")"
The record always 1 2 3 and so on not 001 002 003 ...
Apr 26 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
Hi..
I want to save a number like 001 and so on in access database.
I've tried something like this but it didn't work
strSQL = "Insert into [User] (UserID) VALUES" & "(" & Format(strNewID, "0##") & ")"
The record always 1 2 3 and so on not 001 002 003 ...
Numbers are just stored as a numeric amount, not as a specific format (such as your three digits). If you want to actually store them that way, you would have to put them in a Text field.

It's more likely, though, that what you need to do is simply store the value as a number, and format it when retrieved. You can set a format on the table field in Access, so that Access will display it that way. In VB, just format the number when you retrieve it from the table, before printing or displaying it.
Apr 26 '07 #2

Post your reply

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