Parsing Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am wanting to look at the value in 1 field and if the 1st byte is a 4, move
some literal to a textbox on the form. I thought I understood how to do it
but it is not working and I am at a loss. All of this is on a form. My VB
coding skill is not very good so please be detailed.

Thanks for everything!

Kent
 
I am wanting to look at the value in 1 field and if the 1st byte is a 4,
move
some literal to a textbox on the form. I thought I understood how to do
it
but it is not working and I am at a loss. All of this is on a form. My
VB
coding skill is not very good so please be detailed.

You might actually be able to do this without code. You don't mention what
value you need to display.

However if you place a un-bound text box on your form, you can set the data
source as:

=(iif(left([ThatField],1) = "4","this is a literal value for 4","not 4
value"))
 
I apologize for not giving you the full story; my bad.

I am wanting to look at the 1st number of a credit card number and then make
the determination as follows

If the 1st number is 3, I want to show 'Amex'
If the 1st number is 4, I want to show 'Visa'
If the 1st number is 5, I want to show 'Mast'
If the 1st number is 6, I want to show 'Disc'

I did not think the data source would handle the multiple ifs. If that is
not true and it will, please send example.

Thanks,
Kent

Albert D. Kallal said:
I am wanting to look at the value in 1 field and if the 1st byte is a 4,
move
some literal to a textbox on the form. I thought I understood how to do
it
but it is not working and I am at a loss. All of this is on a form. My
VB
coding skill is not very good so please be detailed.

You might actually be able to do this without code. You don't mention what
value you need to display.

However if you place a un-bound text box on your form, you can set the data
source as:

=(iif(left([ThatField],1) = "4","this is a literal value for 4","not 4
value"))
 
I am wanting to look at the 1st number of a credit card number and then
make
the determination as follows

If the 1st number is 3, I want to show 'Amex'
If the 1st number is 4, I want to show 'Visa'
If the 1st number is 5, I want to show 'Mast'
If the 1st number is 6, I want to show 'Disc'

I did not think the data source would handle the multiple ifs. If that is
not true and it will, please send example.

Ah, ok. Just build a table called tblCards as follows:

CardID CardType
3 Amex
4 Visa'
5 Mast
6 Disc

Then, for that expression go:

=( dookup("CardType", "tblCards","cardID = " & Left([address],1) ) )

You could even add more descriptive text...spell out complete whole card
name if you wished....
 
I must have missed something. I made the table with same names then inserted
the values. Then I entered

=(DookUp("CardType","tblcards","cardID = " & Left([cc_number],1)))
in the Control Source area of the unbound textbox.

When I switch to form view, I get #Error displaying in the box rather than
the value. What am I doing wrong?


Albert D. Kallal said:
I am wanting to look at the 1st number of a credit card number and then
make
the determination as follows

If the 1st number is 3, I want to show 'Amex'
If the 1st number is 4, I want to show 'Visa'
If the 1st number is 5, I want to show 'Mast'
If the 1st number is 6, I want to show 'Disc'

I did not think the data source would handle the multiple ifs. If that is
not true and it will, please send example.

Ah, ok. Just build a table called tblCards as follows:

CardID CardType
3 Amex
4 Visa'
5 Mast
6 Disc

Then, for that expression go:

=( dookup("CardType", "tblCards","cardID = " & Left([address],1) ) )

You could even add more descriptive text...spell out complete whole card
name if you wished....
 
I assume the cardID collum is number type field....it has to be as
written....
 

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

Similar Threads

Parsing Question 3
Parsing String Data Into Access 4
Excel Concatenate Form Name to Parse for function 1
Parsing a table 1
Data Validation 10
PARSE routine 8
Textbox Problem 1
mirror data from subform to main form 3

Back
Top