-1 True Value

  • Thread starter Thread starter Cynthia
  • Start date Start date
C

Cynthia

How do you change a -1 true value to a positive 1 so it shows up as just 1 on
the corresponding table?
 
Cynthia said:
How do you change a -1 true value to a positive 1 so it shows up as just 1
on
the corresponding table?


You'd need to use an integer or other numeric field in the table design,
rather than a Yes/No field, and you'd need either use some other control
than a check box on the form, or else use code in the form's BeforeUpdate
event to change the value from -1 to 1 before saving the record.

Or you could leave the table and form as they are, and use a query to
convert the -1 to 1 whenever you need to report, export, or sum it.
 
Thanks. It does make more sense to leave it and just run queries and convert
it. How do I convert it?
 
Cynthia said:
Thanks. It does make more sense to leave it and just run queries and
convert
it. How do I convert it?


The details will depend on exactly what you want to do with the information.
But for example, you could have a query with SQL like this:


SELECT
ID,
SomeOtherField,
IIf(YesNoField<>0, 1, 0) As ConvertedYesNoField
FROM YourTable;

Does that make sense to you?
 
You don't really need a query to do this, just use the Abs() function
whenever you're dealing with it.

Abs(YourField)
Thanks. It does make more sense to leave it and just run queries and convert
it. How do I convert it?
[quoted text clipped - 7 lines]
Or you could leave the table and form as they are, and use a query to
convert the -1 to 1 whenever you need to report, export, or sum it.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Linq Adams via AccessMonster.com said:
You don't really need a query to do this, just use the Abs() function
whenever you're dealing with it.

Abs(YourField)


Two points, Linq:

1. Thinking about the circumstances that may be prompting Cynthia's
question, I imagine that most of the time basing *whatever* it is on a query
that does the conversion would be the simplest solution, and would involve
no VBA code.

2. If you were recommending calling the Abs() function from the query, I'd
suggest that's not a good idea, as it would force a call to the expression
service to resolve the VBA function. Using IIf() in the query won't do
that, as it's built into Jet SQL. I could be wrong about the Abs() function
not being built in, but I don't think so.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top