| re: import doubt?
friend05 wrote:[color=blue]
> hi,
> i don't have any idea about msaccess.
>
> i am having one text file in following manner.
>
> txt file:
>
> AU Oren, EE
> Tamerler, C
> Sarikaya, M
> ISI:000227563700002
> AU Peng, CY
> Kalkan, AK
> Fonash, SJ
> Gu, B
> Sen, A
> ISI:000227563700007
>
>
> can i import this file in Ms Access and arrange it in table form in
> following manner:
>
> ID AU
>
> 000227563700002 Oren, EE
> 000227563700002 Tamerler, C
> 000227563700002 Sarikaya, M
> 000227563700007 Peng, CY
> 000227563700007 Kalkan, AK
> 000227563700007 Fonash, SJ
> 000227563700007 Gu, B
> 000227563700007 Sen, A
>
>
> so that i can use it with my other data.
>
> if yes ? how ??[/color]
Import the text file directly into an Access table (tblImport). Go
into table design and add an Autonumber ID field called 'ID1' because
we're going to be breaking database design principles by relying on the
order the records are stored. Save the design. Go into Table Design
again and change the default field name there to AU1. Save. Your
table should look like:
tblImport
ID1 AU1
1 AU Oren, EE
2 Tamerler, C
3 Sarikaya, M
4 ISI:000227563700002
5 AU Peng, CY
6 Kalkan, AK
7 Fonash, SJ
8 Gu, B
9 Sen, A
10 ISI:000227563700007
....
SELECT (SELECT Right(First(A.AU1), Len(First(A.AU1)) - 4) FROM
tblImport AS A WHERE Left(A.AU1, 4) = 'ISI:' AND A.ID1 >=
tblImport.ID1) AS ID, IIf(Left(AU1, 3) = 'AU ', Right(AU1, Len(AU1) -
3), Trim(AU1)) AS AU FROM tblImport WHERE Left(tblImport.AU1, 4) <>
'ISI:';
produces:
ID AU
000227563700002 Oren, EE
000227563700002 Tamerler, C
000227563700002 Sarikaya, M
000227563700007 Peng, CY
000227563700007 Kalkan, AK
000227563700007 Fonash, SJ
000227563700007 Gu, B
000227563700007 Sen, A
....
Someone whose last name is Au Claire won't have it changed to Claire if
the two spaces are typical.
I hope this helps,
James A. Fortune |