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

Prepare a number

P: n/a
Hi!
I have a form where a user can choose to print a record.
If it is the first time he prints a record, I want a field on the form
start with, say: 1000 and I will increase thereafter like this:

yourNumber = DMax("[Occurrences]","tblEvents") + 1

At the same time, another field will have date and time of printing. And a
checkbox will be marked, as a status info to the user.

But my question is: How can I write a function that examines if
field: "Occurences" are empty (Null) and have it start at 999, so when
user choose to print first time, the actual value will be: 1000? And thereafter
of course, field: "yourNumber" will be updated: 1001,1002 etc..

I know I can do this by an append query, append 999 to tblEvents, delete
the append query and distribute a new database. Then the same effect will
happen.

However I'd like to do it in code, so the code always check if there
actually is a value or Null value when he chooses to print.

Anybody have a suggestion?
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Use Nz() to supply the value if null:
= Nz(DMax("[Occurrences]","tblEvents"), 999) + 1

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Geir Baardsen" <ge***********@hotmail.com> wrote in message
news:35**************************@posting.google.c om...

I have a form where a user can choose to print a record.
If it is the first time he prints a record, I want a field on the form
start with, say: 1000 and I will increase thereafter like this:

yourNumber = DMax("[Occurrences]","tblEvents") + 1

At the same time, another field will have date and time of printing. And a
checkbox will be marked, as a status info to the user.

But my question is: How can I write a function that examines if
field: "Occurences" are empty (Null) and have it start at 999, so when
user choose to print first time, the actual value will be: 1000? And
thereafter
of course, field: "yourNumber" will be updated: 1001,1002 etc..

I know I can do this by an append query, append 999 to tblEvents, delete
the append query and distribute a new database. Then the same effect will
happen.

However I'd like to do it in code, so the code always check if there
actually is a value or Null value when he chooses to print.

Anybody have a suggestion?

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.