Negative numbers in a table

hboisteau

Registered User.
Local time
Today, 10:35
Joined
Jun 5, 2012
Messages
14
Hi everybody,
I import a large amount of data in a table for convenience and fast.
Thereafter I create a query and then a new table to compare the data.
After that, I would like to have a message saying that I have negative values ​​in my table.
To be more simple, I seek to control the way a table to see if there are negative values​​.
Thank you in advance.
HB
 
Welcome to the forum.

You could use the DCount() function to count all records that are less than zero and therefore negative.

Something along the lines of;
Code:
If Dcount("yourNumreicRecord", "YourTableName", "yourNumreicRecord <0) = 0 Then
     MsgBox "You have no Negative Records"
Else
     MsgBox "You have " & Dcount("yourNumreicRecord", "YourTableName", "yourNumreicRecord <0) & " Negative records"
End If
 
Thanks for your answer,
but I have a new question, I made a mistake is not for the table but it's for the query.
Where I push the code on this query.
Thanks in advance.
HB
 
The DCount() function can also be used to count the results in a query simply change the table name to the Query name.
 
Thanks,
but one more question, where I push this code?
Macro?
Thanks again,
HB
 
The code in post #2 is VBA so needs to go in a from event. It all depends exactly how you want things to work.
 
Thanks,
this code working, but I need more information inside the MsgBox.
For all records on the table you find the Date and the Number of slots.
I'm looking for an similar MsgBox:

"Slots 1045 negative numbers on the 01/01/12"

Thanks in advance.
HB
 

Users who are viewing this thread

Back
Top Bottom