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

Help with this auto numbering field

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.