Null with a postive number rather than a -1

  • Thread starter Thread starter snakedog
  • Start date Start date
S

snakedog

Problem

While we can get the Is Null to show as default in the form and it
will also
leave the field blank in the table (perfrectit's just what we need!),
selecting a check results in a -1 in the field rather than +1...is
there a
way to set the Valdation Rule in the table so that the Is Null Or
Between -1
And 0 shows a +1 or 0 rather than a -1 on the table field?
 
Why does it matter?

Access uses -1 for True.
Some other data engines use 1.
What difference does it make?

You can use a Number field with 0, 1, and Null if you wish, but Access may
not handle boolean controls (check box, option button, toggle button) the
way you expect.
 
Why does it matter?

Access uses -1 for True.
Some other data engines use 1.
What difference does it make?

You can use a Number field with 0, 1, and Null if you wish, but Access may
not handle boolean controls (check box, option button, toggle button) the
way you expect.

--
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.







- Show quoted text -

Scenario

2 questions worth 100 %

Each question can either be true, false or null

Ie:


Questions in the form:

Did the rep quote the proper price? (checkbox triple state
checked=yes
(value of 1), unckecked=no (value of zero) greyed is n/a)

Did the rep mark down the proper address? (checkbox triple state
checked=yes (value of 1), unckecked=no (value of zero) greyed is n/a)


The idea being that in a query afterwards I can add up all the ones
and have
the value divided by the count minus not applicables to have the
percaentage.
 
So you could use Abs() around the total to lose the sign?
Or just - in front of the Total?
 
So you could use Abs() around the total to lose the sign?
Or just - in front of the Total?

--
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.










- Show quoted text -


Thanks that appears to be working
 
Realistically, I wouldn't recommend relying on how Access stores the value
internally. VB.Net changed from using -1 for true to 1.

The number of Trues is DCount("*", "TableName", "FieldName = True").

The number of Falses is DCount("*", "TableName", "FieldName = False").

In SQL, create a calculated field using the IIf function and sum it.
 
Back
Top