Please help...almost got it.

KingRudeDog

Registered User.
Local time
Today, 18:00
Joined
May 12, 2006
Messages
36
So I almost have this working.

I have a subform <body_style_data> linked to a parent form <test_request>.

I added code to the before_instert function on the subform to give each submitted sample to <body_style_data> an id number <sampleId> starting with 1.

Here is the code...

Me!sampleId = Nz(DMax("[SampleId]", "[body_style_data]"), 0) + 1

and it works great.

But I want it to reset to 1 when the parent form moves to a new record (adding new samples under a new record)

Next line of code please!!!!

So close!
 
King,

I would imagine that your subform (subtable) has the Parent form's primary key
in it's table definition.

Me!sampleId = Nz(DMax("[SampleId]", "[body_style_data]", "[ParentID] = " & Me.ParentID), 0) + 1

Wayne
 
worked like a charm...thanks a bunch!
 

Users who are viewing this thread

Back
Top Bottom