Formatting Numbers in a text box

Grezzo

Registered User.
Local time
Today, 21:46
Joined
Feb 28, 2005
Messages
13
Hi, I have a table with an autonumber field that I want to come out on a report at a 7 digit number. eg 67 would be 0000067.

How do I do this? :confused:

Cheers
 
Format

Put the following in the Control Source of the field:

=Format([YourField],"0000000")

Replace "YourField" with the actual field name.

Happy Easter
 
Cheers for the quick reply. Trucktime you're really helpful, you've answered at least one of my posts before. :)

But...

That didn't work that time, I put =Format([Number],"0000000") in the conrol source, and it comes up with #Error :(

Is this supposed to be getting and formatting data from my record in the table, or from a field already on my report. :confused:

Cheers, and a Happy Easter to you too ;)
 
Format

It has to go in the Control Source of the field on the report.
In other words, nothing is changed in the table itself, the field is only formatted for use on your report.

A problem may be the field name you are using.
"Number" is a reserved word in Access, rename the field in the table to something like "NumberID". Never use field names like "Number" or "Date", it may cause problems at some point.

Also it is good policy to base forms and reports on queries, and not pull data form the table directly.

Good Luck. Always glad to help
 
Last edited:
Solved

Yay, it worked

It was the field being called "Number" that was the problem.

My report is linked to a table, but is opened in with a SQL statement in VB, Is that what you meant by a report getting data from a query? Why is it bad practice to get data from a table anyway?

Cheers
 
Format

Glad it works.

When you use a query you can select only those records you really need, and thus limit the amount of data to be processed. Especially in large databases it will save time. In network environments it can significantly reduce network traffic.

You can also ad calculated fields in a query and manipulate data in different ways without having to save the information in a table (never store calculated data in a table).
And it is also easy to put sort options in a query.
 

Users who are viewing this thread

Back
Top Bottom