Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Incrementing a number for each row

Geek News

Incrementing a number for each row
DontKnow 12/4/2008 1:36:01 AM
Hi Guys,

I need some help in numbering incremental rows for a particular project.

For instance if I have 3 records I am trying to have the name of the
project, a slash and then the nuber of the record.

ie.
RecordNo: Type projectRisk
Record1 Risk 02033/1
Record2 Risk 02033/2
Record3 Risk 02033/3

You see under Project Risk. This is what I am trying to do!
I am able to produce the autonumber of rows but not the 02033/1,2,3 etc All
I am able to get is 02033/1 for all three records using the Default entry in
properties
..
I have tried for several days but to no avail!!

how can I do this??
I am using a subform in datasheet view!!

Cheers
Re: Incrementing a number for each row
Tom van Stiphout <tom7744.no.spam[ at ]cox.net> 12/4/2008 4:12:53 AM
On Wed, 3 Dec 2008 17:36:01 -0800, DontKnow
<DontKnow[ at ]discussions.microsoft.com> wrote:

Why is this important? Unlike the perhaps more familiar Excel
environment in a relational database one hardly ever needs sequential
numbering like this. It often points to a misunderstanding of how
things work in a db as opposed to a spreadsheet. If you could
elaborate, perhaps we can suggest alternatives.

-Tom.
Microsoft Access MVP


[Quoted Text]
>Hi Guys,
>
>I need some help in numbering incremental rows for a particular project.
>
>For instance if I have 3 records I am trying to have the name of the
>project, a slash and then the nuber of the record.
>
>ie.
>RecordNo: Type projectRisk
>Record1 Risk 02033/1
>Record2 Risk 02033/2
>Record3 Risk 02033/3
>
>You see under Project Risk. This is what I am trying to do!
>I am able to produce the autonumber of rows but not the 02033/1,2,3 etc All
>I am able to get is 02033/1 for all three records using the Default entry in
>properties
>.
>I have tried for several days but to no avail!!
>
>how can I do this??
>I am using a subform in datasheet view!!
>
>Cheers
Re: Incrementing a number for each row
DontKnow 12/4/2008 5:02:01 AM
Its for a risk database so that when somone looks at a risk register someone
can see the number of a risk. Depending on the allocated risk whether it is
high medium or low is transferred to another table. This allocated number
allows the managers to easily see from where the risk came from and from
which project.

ie. 02008/1 refers to a risk from maitland and is the first risk etc

I hope this is clearer!!

Cheers

"Tom van Stiphout" wrote:

[Quoted Text]
> On Wed, 3 Dec 2008 17:36:01 -0800, DontKnow
> <DontKnow[ at ]discussions.microsoft.com> wrote:
>
> Why is this important? Unlike the perhaps more familiar Excel
> environment in a relational database one hardly ever needs sequential
> numbering like this. It often points to a misunderstanding of how
> things work in a db as opposed to a spreadsheet. If you could
> elaborate, perhaps we can suggest alternatives.
>
> -Tom.
> Microsoft Access MVP
>
>
> >Hi Guys,
> >
> >I need some help in numbering incremental rows for a particular project.
> >
> >For instance if I have 3 records I am trying to have the name of the
> >project, a slash and then the nuber of the record.
> >
> >ie.
> >RecordNo: Type projectRisk
> >Record1 Risk 02033/1
> >Record2 Risk 02033/2
> >Record3 Risk 02033/3
> >
> >You see under Project Risk. This is what I am trying to do!
> >I am able to produce the autonumber of rows but not the 02033/1,2,3 etc All
> >I am able to get is 02033/1 for all three records using the Default entry in
> >properties
> >.
> >I have tried for several days but to no avail!!
> >
> >how can I do this??
> >I am using a subform in datasheet view!!
> >
> >Cheers
>
Re: Incrementing a number for each row
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 12/4/2008 6:36:31 AM
DontKnow wrote:
[Quoted Text]
> Hi Guys,
>
> I need some help in numbering incremental rows for a particular
> project.
>
> For instance if I have 3 records I am trying to have the name of the
> project, a slash and then the nuber of the record.
>
> ie.
> RecordNo: Type projectRisk
> Record1 Risk 02033/1
> Record2 Risk 02033/2
> Record3 Risk 02033/3
>
> You see under Project Risk. This is what I am trying to do!
> I am able to produce the autonumber of rows but not the 02033/1,2,3
> etc All I am able to get is 02033/1 for all three records using the
> Default entry in properties

I would say that the project should be in a master record and the risks in a
related table

ProjectRisk would be calculated with ProjectRisk:ProjectID &"/"& RiskNumber.
in a query.

If Is Null RiskNumber then
RiskNumber = 1
else
RiskNumber = DMax ("RiskNumber", "RiskNumberTable", "ProjectID = " &
someField) + 1
End If


Re: Incrementing a number for each row
DontKnow 12/4/2008 8:20:01 AM
Hi Mike,

Thanks for your reply!!

Where should I place this code??

Should I have a unbound or bound text box??

Please advise!!

Cheers,

thankks again for your help!!

This is quite difficult!!


"Mike Painter" wrote:

[Quoted Text]
> DontKnow wrote:
> > Hi Guys,
> >
> > I need some help in numbering incremental rows for a particular
> > project.
> >
> > For instance if I have 3 records I am trying to have the name of the
> > project, a slash and then the nuber of the record.
> >
> > ie.
> > RecordNo: Type projectRisk
> > Record1 Risk 02033/1
> > Record2 Risk 02033/2
> > Record3 Risk 02033/3
> >
> > You see under Project Risk. This is what I am trying to do!
> > I am able to produce the autonumber of rows but not the 02033/1,2,3
> > etc All I am able to get is 02033/1 for all three records using the
> > Default entry in properties
>
> I would say that the project should be in a master record and the risks in a
> related table
>
> ProjectRisk would be calculated with ProjectRisk:ProjectID &"/"& RiskNumber.
> in a query.
>
> If Is Null RiskNumber then
> RiskNumber = 1
> else
> RiskNumber = DMax ("RiskNumber", "RiskNumberTable", "ProjectID = " &
> someField) + 1
> End If
>
>
>
Re: Incrementing a number for each row
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 12/5/2008 12:02:48 AM
ProjectRisk would be calculated with ProjectRisk:ProjectID &"/"& RiskNumber
in a query.
Build the query and add the above to as a field in the query.

DontKnow wrote:
[Quoted Text]
> Hi Mike,
>
> Thanks for your reply!!
>
> Where should I place this code??
>
> Should I have a unbound or bound text box??
>
> Please advise!!
>
> Cheers,
>
> thankks again for your help!!
>
> This is quite difficult!!
>
>
> "Mike Painter" wrote:
>
>> DontKnow wrote:
>>> Hi Guys,
>>>
>>> I need some help in numbering incremental rows for a particular
>>> project.
>>>
>>> For instance if I have 3 records I am trying to have the name of the
>>> project, a slash and then the nuber of the record.
>>>
>>> ie.
>>> RecordNo: Type projectRisk
>>> Record1 Risk 02033/1
>>> Record2 Risk 02033/2
>>> Record3 Risk 02033/3
>>>
>>> You see under Project Risk. This is what I am trying to do!
>>> I am able to produce the autonumber of rows but not the 02033/1,2,3
>>> etc All I am able to get is 02033/1 for all three records using the
>>> Default entry in properties
>>
>> I would say that the project should be in a master record and the
>> risks in a related table
>>
>> ProjectRisk would be calculated with ProjectRisk:ProjectID &"/"&
>> RiskNumber. in a query.
>>
>> If Is Null RiskNumber then
>> RiskNumber = 1
>> else
>> RiskNumber = DMax ("RiskNumber", "RiskNumberTable", "ProjectID = "
>> & someField) + 1
>> End If


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net