By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,695 Members | 1,638 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,695 IT Pros & Developers. It's quick & easy.

select a number from a form, add 1 and write it in a Field on the form

P: n/a
I have a problem with a Select statement.
I want to select a colom (only a number) from a Table, when I start a form
and add 1 to the number and write the result in a Field on the form.
And than, i want to save it in the same Table and colom!

My select statement is usually like this:

SELECT Max([thenumer])+1 AS numer FROM mytable;

But it dosent woks :(
I cant write VB code. I am looking for a way to solve my problem without
VB code.

Thanks, Amir
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
amir wrote:
I have a problem with a Select statement.
I want to select a colom (only a number) from a Table, when I start a form
and add 1 to the number and write the result in a Field on the form.
And than, i want to save it in the same Table and colom!

My select statement is usually like this:

SELECT Max([thenumer])+1 AS numer FROM mytable;

But it dosent woks :(
I cant write VB code. I am looking for a way to solve my problem without
VB code.


That's a bit like trying to service your car without a socket set or
screwdriver, you can top up all the fluids but you want to gap the spark
plugs.

Using VBA you'd do something like:

Sub Form_BeforeInsert(Cancel As Integer)
Me!MyNum = Nz(DMax("MyNum","MyTable")+1,1)
End Sub

Just replace column and table names to suit. If you find an easier way
without VBA then let us know.

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.