Convert text to number

  • Thread starter Kristl via AccessMonster.com
  • Start date
K

Kristl via AccessMonster.com

I have a 2 part question.

1) How do I convert text stored in a table to numbers. It differs from
question to question, but basically I need to convert T to1 and F to 2.

2) How can I fix the table from here on out to automatically store the
numbers based on what I type into the form? Eg; Question 1 I type T into the
form, the table stores a 1. Question 2 I type an F into the form, the table
stores it as a 1.
 
K

KARL DEWEY

1) How do I convert text stored in a table to numbers.
Use an IIF statement --
Expr1: IIF(
.[TextBox] = "T", "1", "2")
OR
Expr1: IIF(
.[TextBox] = "T", 1, 2)
numbers based on what I type into the form?
Use a Combo box on the form with data list. It will also work to display
what is stored also.
 
K

Kristl via AccessMonster.com

Thanks! Now, where exactly do I put this formula? :)

KARL said:
Use an IIF statement --
Expr1: IIF(
.[TextBox] = "T", "1", "2")
OR
Expr1: IIF(
.[TextBox] = "T", 1, 2)
numbers based on what I type into the form?
Use a Combo box on the form with data list. It will also work to display
what is stored also.
I have a 2 part question.
[quoted text clipped - 5 lines]
form, the table stores a 1. Question 2 I type an F into the form, the table
stores it as a 1.
 
K

KARL DEWEY

Open your query in design view and put in the Field row in an empty column.
Substitute your own desired name for Expr1 and the name of your text field
for [TextBox].

numbers based on what I type into the form?
Why do you want to enter text and store numbers? The formula I gave is to
convert stored text to numbers.

Do you want to store number instead of text? If so, then you need to add a
new field that is datatype number and run an update query using the formula.
Then your form can have a combo box that displays text entry but stores
numbers.

--
KARL DEWEY
Build a little - Test a little


Kristl via AccessMonster.com said:
Thanks! Now, where exactly do I put this formula? :)

KARL said:
1) How do I convert text stored in a table to numbers.
Use an IIF statement --
Expr1: IIF(
.[TextBox] = "T", "1", "2")
OR
Expr1: IIF(
.[TextBox] = "T", 1, 2)
2) How can I fix the table from here on out to automatically store the
numbers based on what I type into the form?
Use a Combo box on the form with data list. It will also work to display
what is stored also.
I have a 2 part question.
[quoted text clipped - 5 lines]
form, the table stores a 1. Question 2 I type an F into the form, the table
stores it as a 1.
 
Top