Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autonumber prefix question

Status
Not open for further replies.

Janatwork

Programmer
Dec 16, 2003
22
GB
Hi,
I'm using autonumber for my header record form, A000000, and I want to display the same number in my detail record form. It does show the number but not the prefix, any ideas what I need to do to get it to show would be a great help!

Thanks [lipstick]
 
An autonumber is an autonumber -> only the number.

You can format (display) the number by using "A"0000.... in the format property of the field in the table/control on the form, just remember it isn't stored that way...

Roy-Vidar
 
Ah... that would explain it then!
Thanks for this, I might have to look at an alternative numbering sequencing then!!
[lipstick]
 
There is no way at all that you are using an autonumber which is stored as A0000000. What you probably have is an autonumber field with a display format which adds the prefix.
To link to a detail record you must use the unformatted number, and as you say Access is correctly doing that.
You can use the display format property in the field in your detail form to add the A again (copy the format from the main form or the table definition, wherever this has been done). You are going to have to set the format everywhere you use the field.
 
Hi again,

I'm confused, nothing strange there though......
In my table field property I have against format \A000000
In my table data I have one saved record which has the autonumber as I want it i.e. A000043, in this instance. I thought because it has been saved into the table as A000043, then I would be able to use it elsewhere.


Sales Order No Line No Order No Order Line No Customer Product Code Qty Required Date Promised Date Price Despatch Method Product Code Currency Type Order Date Desc Customer No
A000043 2 PC00010 1 3212ret 100 30/06/2005 30/06/2005 1.12 Air 632055 RNB 24/06/2005 00684001
 
A000043 is stored in the table as 43, but because it's format property is set to \A000000 it is displayed like you say.

Whether or not it displays like this everywhere, depends on a lot of stuff, whether the format property of the controls are set accordingly, whether the control was added prior to adding the format property of the table (which influences what's present in the format property of the control), whether you're using those dreaded table level lookups (The Evils of Lookup Fields in Tables)...

But - this means you are assigning a business meaning to an autonumber, which in general, is discouraged for several reasons - search these fora on Autonumber to find out why...

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top