Autonumber (1 Viewer)

ielamrani

Registered User.
Local time
Today, 13:27
Joined
May 6, 2008
Messages
51
Hi,
I am stuck on the following and I need help.

I added an autonumber for each record and it worked doing this under formula fields:

WhilePrintingRecords;
Global NumberVar x;
x:=x+1;
x

what's not working is when I have 2 similar records I want to show each with unique number. for example

Mom3 has 2 babies: BA1 and BA2

the count should by mom instead of by baby

I want autonumber to be 3 for both


Autonumber ------- Name ------------Baby

1--------------- Mom1 ------------BA1
2 --------------- Mom2 ------------BA2
3--------------- Mom3 ------------BA1
4 --------------- Mom3 -----------BA2
5 --------------- Mom4 -------------BA1

Thank you advance
 

GohDiamond

"Access- Imagineer that!"
Local time
Today, 13:27
Joined
Nov 1, 2006
Messages
550
You need a query and two tables (Moms, Babies)
List of Moms Names with Autonumber
List of Babies with Babyname and Mom's Autonumber
Join the List of Mom's to the List of Babies by the Autonumber using a Left Join (one to many)
SELECT Moms.AutoNum, Moms.MomName, Babies.BabyName
FROM Moms LEFT JOIN Babies ON Moms.AutoNum = Babies.MomsNumber;

Hope that helps,
Goh
 

ielamrani

Registered User.
Local time
Today, 13:27
Joined
May 6, 2008
Messages
51
Sorry I missed to mention that this is done in Crystal Reports and Mom and baby's data are in the same table.

thank you
 

kevlray

Registered User.
Local time
Today, 10:27
Joined
Apr 5, 2010
Messages
1,046
You can create a command (thus using SQL code) and do a self join by using an aliased table. You also in crystal do a running total that only evaluates when mom <> next(mom).
 

Users who are viewing this thread

Top Bottom