473,408 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Prepare a number

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
1 1075
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Randy Rodent | last post by:
I have a problem with some SQL code that can be run at the mySQL command prompt, and in PHP, I can prepare it with no problem, but I get a syntax error when I try and exexute it. $sql = <<< EOF...
2
by: bastb | last post by:
Hi, We've been using the perl DBD::DB2 driver on Perl version 5.8.0 (aix_thread_multi) for a project we're working on without any problems until now. We've been using DBD::DB2 version 0.78 on...
0
by: RG | last post by:
OleDbCommand.Prepare error: Size of parameter (VB.NET 2003) I need to do a SQL INSERT statement into an Access table, and I’d like to use the exact technique described in the Help file example...
2
by: Rajat Katyal | last post by:
Hi: I prepare the statement for execution as follows: PREPARE query(text) as SELECT count(*) FROM transform_customer_billing where inv_no = $1; The problem is Iam not able to execute this...
3
by: howachen | last post by:
Hi, When doing mysql query (SELECT statements) in php, we often use prepare statement to prevent SQL injection. However, I just noticed that the prepare statements can SLOW the number of queries...
1
by: gmccammon | last post by:
I'm having problems with my Prepare and Execute statements. I get a syntax error onmy prepare and of course the execute won't run on an undefined value. I don't know what I am overlooking. ...
2
by: sauve mark | last post by:
exec sp_prepare
3
by: Sagar | last post by:
Hi. I am working on a project to migrate a web application from 1.1 to 2.0 Within in the DAL of the application, there is a call to below function that builds a command object for later use. ...
1
by: Massimiliano Campagnoli | last post by:
Hy, I am trying to understand how the prepare statement works. I am using Qt C++ library to access db2: { .... QSqlQuery cust_query; cust_query.prepare("SELECT CUST_NAME FROM CUSTOMERS...
0
by: pankaj17 | last post by:
hello everyone, MYSQL query ............ how to set prepare stmt result in variable i have written prepare stmt in store procedure and i want to set result of prepare stmt in variable ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.