Add Next Number To A Field

A

Ange Kappas

Hi,
This is probably so simple I can't seem to figure it out.

I have a Table(tblACCOUNTNO) which has only one field called ACCOUNT NUMBER
and starts from number 1.

I want to add code to a form button which will add a new record to the
'tblACCOUNTNO' and it will be the next number in other words +1, which in
this case will be number 2.

How simple does that sound.

Thanks
Ange
 
F

fredg

Hi,
This is probably so simple I can't seem to figure it out.

I have a Table(tblACCOUNTNO) which has only one field called ACCOUNT NUMBER
and starts from number 1.

I want to add code to a form button which will add a new record to the
'tblACCOUNTNO' and it will be the next number in other words +1, which in
this case will be number 2.

How simple does that sound.

Thanks
Ange

Dim strSQL As String

strSQL = "Insert into tblAccoutino([Account Number]) values (" &
DMax("[Account Number]", "tblAccountino") + 1 & ");"

CurrentDb.Execute strSQL, dbFailOnError
 
A

Ange Kappas

Thanks Fred Appreciated
Ange


fredg said:
Hi,
This is probably so simple I can't seem to figure it out.

I have a Table(tblACCOUNTNO) which has only one field called ACCOUNT
NUMBER
and starts from number 1.

I want to add code to a form button which will add a new record to the
'tblACCOUNTNO' and it will be the next number in other words +1, which in
this case will be number 2.

How simple does that sound.

Thanks
Ange

Dim strSQL As String

strSQL = "Insert into tblAccoutino([Account Number]) values (" &
DMax("[Account Number]", "tblAccountino") + 1 & ");"

CurrentDb.Execute strSQL, dbFailOnError
 

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