473,473 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help with this auto numbering field

I want to know in Access if it is possible to have a table with an
auto number that behaves in the following fashion.

Group ID
A 1
A 2
A 3
A 4
B 1
B 2
B 3
C 1
C 2
......

If this can be done please explain where to look to implement this.
Thanks.
Mar 11 '08 #1
3 1427
rhaazy wrote:
I want to know in Access if it is possible to have a table with an
auto number that behaves in the following fashion.

Group ID
A 1
A 2
A 3
A 4
B 1
B 2
B 3
C 1
C 2
.....

If this can be done please explain where to look to implement this.
Thanks.
Autonumber? No. Number/LongInt? Yes.

You could get a number like
If me.NewRecord Then _
Me.NewID = DMax("ID","TableName","Group = '" & Me.Group & "'") + 1

You'd want to do this when the record is saved.

Sarah
http://www.youtube.com/watch?v=A_jCNchJSyI
Mar 11 '08 #2
On Tue, 11 Mar 2008 09:40:42 -0700, Salad <oi*@vinegar.comwrote:
>rhaazy wrote:
>I want to know in Access if it is possible to have a table with an
auto number that behaves in the following fashion.

Group ID
A 1
A 2
A 3
A 4
B 1
B 2
B 3
C 1
C 2
.....

If this can be done please explain where to look to implement this.
Thanks.

Autonumber? No. Number/LongInt? Yes.

You could get a number like
If me.NewRecord Then _
Me.NewID = DMax("ID","TableName","Group = '" & Me.Group & "'") + 1

You'd want to do this when the record is saved.

Sarah
http://www.youtube.com/watch?v=A_jCNchJSyI

You need to wrap the DMax in a Nz function, otherwise it will error if it is the
first record for a particular group.

Me.NewID = Nz(DMax("ID","TableName","Group = '" & Me.Group & "'")) + 1
Wayne Gillespie
Gosford NSW Australia
Mar 12 '08 #3
On Mar 11, 8:05*pm, Wayne Gillespie <best...@NOhotmailSPAM.com.au>
wrote:
On Tue, 11 Mar 2008 09:40:42 -0700, Salad <o...@vinegar.comwrote:
rhaazy wrote:
I want to know in Access if it is possible to have a table with an
auto number that behaves in the following fashion.
Group * * * * ID
A * * * * * * * 1
A * * * * * * * 2
A * * * * * * * 3
A * * * * * * * 4
B * * * * * * * 1
B * * * * * * * 2
B * * * * * * * 3
C * * * * * * * 1
C * * * * * * * 2
.....
If this can be done please explain where to look to implement this.
Thanks.
Autonumber? *No. *Number/LongInt? Yes.
You could get a number like
* If me.NewRecord Then _
* * Me.NewID = DMax("ID","TableName","Group = '" & Me.Group & "'") + 1
You'd want to do this when the record is saved.
Sarah
http://www.youtube.com/watch?v=A_jCNchJSyI

You need to wrap the DMax in a Nz function, otherwise it will error if it is the
first record for a particular group.

Me.NewID = Nz(DMax("ID","TableName","Group = '" & Me.Group & "'")) + 1

Wayne Gillespie
Gosford NSW Australia- Hide quoted text -

- Show quoted text -
thanks everyone
Mar 12 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wayne Aprato | last post by:
I have a report that shows the results of a query. One of the fields is an autonumber field from the query which shows for instance: 120, 121 , 122 for 3 records. Is there a way to have another...
0
by: MJ | last post by:
I am setting up a database and want my auto numbering on a table to include letters. It works find until I hit 10 then it puts the 1 before the letters. Here is what I am using for format: ...
6
by: MJ | last post by:
No one answered my original e-mail--it probably wasn't clear. I am hoping this makes the question a little clearer. Is it possible to combine both letters and numbers in an auto number? I can't...
0
by: saraDotNet | last post by:
Hi, I'v Two Questions: 1-Is there a way to make an auto numbering avalible in vb.net form textbox as the one in Access db columns when we set the datatype as autonumbering?? 2- I'm working on a...
4
by: smitj2 | last post by:
Hi I am studying an IT course and thought I was just beginning to master the basics of normalization. However I came across an example in my text book that wasnt what I would have arrived at. ...
2
by: bubblegirl | last post by:
Hi, I need help in getting this database to work well (user-friendly) by generating auto client ID. The ID is NOT the auto number that Access automatically create when there is no primary key. ...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
0
by: thya | last post by:
While displaying Datareport, We've Problem On Creating a field that automatically generates row numbers as in Crystal report.
2
by: MNNovice | last post by:
I am working on a database on my CD collection using Access 2003. Some of the table structures are given below. Table 1 tblMusicCategory Field 1: MusicCategoryID - Auto Number (PK) Field 2:...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.