W
W L
Office XP
Windows XP
I asked this question several days ago, but since I know practically zilch
about Access, I did not understand the response (thanks again to Mr. John
Vinson). I'm very adept in Excel, but for my database usage requirements,
Access will work better. Here is my question.
I have a table imported. One of the columns (column heading Idnum) contains
number data ranging from 7 to 9 digits. Since these numbers are TAX id or
Social Security #'s, I have a couple of special formatting requirements. If
I just use a format of 000-00-0000 for this number string, it gives me
leading zeros for all numbers less than 9 digits and correctly formats the
social security numbers. However, this format does not take into account the
TAX ID #'s which should be formatted thusly 00-0000000. Luckily, all tax ID
numbers are greater than 699999999. In Excel, I used an If function. Here is
my Excel formula:
"=IF(RC[-2]<10000000,""00""&LEFT(RC[-2],1)&""-""&LEFT(RC[-1],2)&""-""&RIGHT(
RC[-1],4),IF(RC[-2]<100000000,""0""&LEFT(RC[-2],2)&""-""&LEFT(RC[-1],2)&""-"
"&RIGHT(RC[-1],4),IF(RC[-2]>699999999,LEFT(RC[-2],2)&""-""&RIGHT(RC[-2],7),L
EFT(RC[-2],3)&""-""&LEFT(RC[-1],2)&""-""&RIGHT(RC[-1],4)))"
To translate, this basically says if the number in the cell is less than
10000000 (or 7 digits long), then add two leading zeros, and insert a hyphen
between the 3rd and 4th digit and insert a hyphen between the 5th and 6th
digit. If the number in the cell is less than 100000000 (or 8 digits long)
then add one leading zero, and insert a hyphen between the 3rd and 4th digit
and insert a hyphen between the 5th and 6th digit. If the cell is greater
than 699999999, then insert a hyphen between the 2nd and 3rd digit. If none
of the conditions apply (else), then insert a hyphen between the 3rd and 4th
digit and insert a hyphen between the 5th and 6th digit.
I know how to get to design view on my table but I cannot say whether the
function I need to perform on this column can be done from there. I also
know how to create queries in Access, but i do not know if the function I
need to perform on this column can be done from there either. I would
appreciate if someone could give me detailed instructions on how to perform
this function or direct me to a resource where i can learn on my own how to
perform this function.
Thank you in advance for any assistance you can provide.
Windows XP
I asked this question several days ago, but since I know practically zilch
about Access, I did not understand the response (thanks again to Mr. John
Vinson). I'm very adept in Excel, but for my database usage requirements,
Access will work better. Here is my question.
I have a table imported. One of the columns (column heading Idnum) contains
number data ranging from 7 to 9 digits. Since these numbers are TAX id or
Social Security #'s, I have a couple of special formatting requirements. If
I just use a format of 000-00-0000 for this number string, it gives me
leading zeros for all numbers less than 9 digits and correctly formats the
social security numbers. However, this format does not take into account the
TAX ID #'s which should be formatted thusly 00-0000000. Luckily, all tax ID
numbers are greater than 699999999. In Excel, I used an If function. Here is
my Excel formula:
"=IF(RC[-2]<10000000,""00""&LEFT(RC[-2],1)&""-""&LEFT(RC[-1],2)&""-""&RIGHT(
RC[-1],4),IF(RC[-2]<100000000,""0""&LEFT(RC[-2],2)&""-""&LEFT(RC[-1],2)&""-"
"&RIGHT(RC[-1],4),IF(RC[-2]>699999999,LEFT(RC[-2],2)&""-""&RIGHT(RC[-2],7),L
EFT(RC[-2],3)&""-""&LEFT(RC[-1],2)&""-""&RIGHT(RC[-1],4)))"
To translate, this basically says if the number in the cell is less than
10000000 (or 7 digits long), then add two leading zeros, and insert a hyphen
between the 3rd and 4th digit and insert a hyphen between the 5th and 6th
digit. If the number in the cell is less than 100000000 (or 8 digits long)
then add one leading zero, and insert a hyphen between the 3rd and 4th digit
and insert a hyphen between the 5th and 6th digit. If the cell is greater
than 699999999, then insert a hyphen between the 2nd and 3rd digit. If none
of the conditions apply (else), then insert a hyphen between the 3rd and 4th
digit and insert a hyphen between the 5th and 6th digit.
I know how to get to design view on my table but I cannot say whether the
function I need to perform on this column can be done from there. I also
know how to create queries in Access, but i do not know if the function I
need to perform on this column can be done from there either. I would
appreciate if someone could give me detailed instructions on how to perform
this function or direct me to a resource where i can learn on my own how to
perform this function.
Thank you in advance for any assistance you can provide.