Increment Within Query

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
 
A

AccessVandal via AccessMonster.com

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
 
C

ckerns

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
 
C

ckerns

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top