472,958 Members | 2,209 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

default set to 'max+1'

Hey folks -

I have a field that is a number. For new records, I want it to default to
the highest value of that field +1. What is the syntax for the default
value?

Steve Lefevre
Nov 12 '05 #1
1 2348
Steve Leferve wrote:
Hey folks -

I have a field that is a number. For new records, I want it to default to
the highest value of that field +1. What is the syntax for the default
value?

Steve Lefevre

If an autonumber's no good for you (and it's no good for anyone but the
machine!!!) then don't ever use a default value in this way, two people
open the form and add a record they'll get the same number, horrendous
results.

Use a BeforeUpdate procedure, e.g.

(air code)
Sub Form_BeforeUpdate(Cancel As Integer)
If isnull(MySeqNo) Then
MySeqNo = Nz(DMax("MySeqNo","MyTable"),0)+1
end if
End Sub

--
But why is the Rum gone?
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Klaus Alexander Seistrup | last post by:
Hi, After upgrading my Python interpreter to 2.3.1 I constantly get warnings like this: DeprecationWarning: Non-ASCII character '\xe6' in file mumble.py on line 2, but no encoding declared;...
2
by: Sheila King | last post by:
Here is something that surprised me tonight: >>> def myfunc(x, y, a='A', *mylist): print x print y print a for item in mylist: print item
4
by: Ka | last post by:
I install a mysql server in default installation with latin charset, but I want to use GBK(a chinese charset), so that I can store and search chinese words directly. so, I download, unpack and...
41
by: JKop | last post by:
I was doing some Win32 programming today, having to include the file "windows.h". Anyway, I'm thinking of writing a program that'll work like so: macrodestroyer.exe windows.h What this program...
2
by: Lauren Quantrell | last post by:
Is there a way to set Max Default Records in VBA code? Application.SetOption ???, 0 lq
7
by: Vyssokih Max | last post by:
Hello! In C++, I can wrote: void Update(int count = 0) {...} and use it without parameters or with one parameter
3
by: Maxwell2006 | last post by:
Hi, When I run a web service project, ASP.NET shows me a default web method invoke page. How can I disable/modify the default test (or method invoke) page of the ASP.NET web services? ...
0
by: spatik | last post by:
Hi, I have a tableevent] with a columnevent_description] as ntext and default value ''. Now, I want to change the column type to nvarchar(max) using this script, alter table alter column ...
3
by: ose | last post by:
When the type specifier is missing for variable "register i", what's the default type assumed in C? int redian(int Max) { register i; for (i = 1; i <= Max; i++) ... }
3
by: mcolson | last post by:
In my form, I am trying to set up a field so that its default is the max of that field + 1. I have gone to my form, design view and clicked on the data tab. From there I clicked on the elipses...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.