Increment Within Query

  • Thread starter Thread starter ckerns
  • Start date Start date
C

ckerns

Db has client and client account tables.

Client is given id (DbPrefix), client account is given id (DbIDSuffix)
so each sale is identified as 123-2 (DbPrefix-DbSuffix)...client123,
account 2 for that sale's client.

Form and subform are based on queries.

Here's what I'd like to do:

have the query for subform automatically apply the next
appropriate DBIDSuffix. In other words, if a new account is added to
a pre-existing client I want the query to automatically input the
correct suffix number for the new account.

tia,

CKerns
 
Hi,

Hmmm….

I would start something like………

Watch for word wrap.

‘in the subform beforeupdate event
If Recordset is New then
Me.DbSuffix = Me.Parent.DbPrefix & “-“ & Me.RecordsetClone.Recordcount + 1
Else
‘do something
End if
 
Thanks for your help.

What syntax do I use to test for a new Recordset? I've tried a few
things but nothing works for me.

Thanks.

ck
 
Doh! I figured it out.

Thanks anyway!!

ck

Hi,

Hmmm….

I would start something like………

Watch for word wrap.

‘in the subform beforeupdate event
If Recordset is New then
Me.DbSuffix = Me.Parent.DbPrefix & “-“ & Me.RecordsetClone.Recordcount + 1
Else
‘do something
End if
 
Back
Top