Text files content handling in Access 2003

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jamad
    New Member
    • Oct 2006
    • 1

    #1

    Text files content handling in Access 2003

    I want to extract some information in a text file that is not tab, comma and space separated. The format of the text file is actually unknown.
    The problem now is, i want to extract like three lines from each section of the text file content, break the lines into different part and use the broken info to populate an already created table in ms access ( all these should be carried out at a press of a cmd button using VBA code in access or VB code)

    uploadRemoteInv entory started at 2006/09/21 <Intel_dub>
    USER LABEL : Intel_dub/r01sr1/board#01
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#02
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Date (00) : 03/03/07
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#03
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Serial number : CL030803249
    Date (00) : 03/03/13
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#04
    unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    NG INFORMATION
    Serial number : CL031100082
    Date (00) : 03/03/19
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#05
    unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Serial number : CL031402599
    Date (00) : 03/04/07
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#06
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Serial number : CL031100199
    Date (00) : 03/03/20
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#07
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Serial number : CL030803614
    Date (00) : 03/03/19
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#08
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Serial number : CL031100300
    Date (00) : 03/03/22
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#09
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Serial number : CL031100330
    Date (00) : 03/03/22
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#10
    Unit type : CONGI
    Unit part number : 3AL78830AAAH04
    Software part number : --------------
    Serial number : CL031391468
    Date (00) : 03/03/13
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#11
    Unit type : SERVICE
    Unit part number : 3AL78817AAAF02
    Software part number : --------------
    Serial number : FA031157589
    Date (00) : 03/03/11
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#12
    Unit type : CONGI
    Unit part number : 3AL78830AAAH04
    Software part number : --------------
    Serial number : CL031391697
    Date (00) : 03/03/14
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#13
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Serial number : CL031100299
    Date (00) : 03/03/22
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#14
    Unit type : A21E1
    Unit part number : 3AL78832AAAF02
    Software part number : --------------
    Serial number : CL050500668
    Date (00) : 05/03/04
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#15
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Serial number : CL031100279
    Date (00) : 03/03/22
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#22
    Unit type : EQUICO
    Unit part number : 3AL78836AAAM02
    Software part number : --------------
    Serial number : CL030607199
    Date (00) : 03/03/06
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#23
    Unit type : MATRIXN
    Unit part number : 3AL78848BAAH01
    Software part number : --------------
    Serial number : FA031060552
    Date (00) : 03/03/07
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#24
    Unit type : P63E1
    Unit part number : 3AL79092AAAE02
    Software part number : --------------
    Serial number : CL030810111
    Date (00) : 03/02/21
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#25
    Unit type : S-4.1N
    Unit part number : 3AL78856BBAB01
    Software part number : --------------
    Serial number : FA030859487
    Date (00) : 03/02/26
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#26
    Unit type : S-4.1N
    Unit part number : 3AL78856BBAC01
    Software part number : --------------
    Serial number : FA031157458
    Date (00) : 03/03/12
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#27
    Unit type : P63E1
    Unit part number : 3AL79092AAAE02
    Software part number : --------------
    Serial number : CL012963743
    Date (00) : 02/08/22
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#30
    Unit type : P63E1
    Unit part number : 3AL79092AAAE02
    Software part number : --------------
    Serial number : CL014243762
    Date (00) : 02/08/22
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    Using the information above, i want to create a table in access that will contain 10 or above columns. these colunm are;

    1. User Label colunm will contain this info: INTER_LAG_PTO i.e the first set of characters after the ":" and before the first "/" sign
    2. ADM Type: Name of the Mahine (to be determined using code)
    3. Unit Type: A21E1 (Used to determine name of the machine)
    4. Site Name: Name of the site (this will be populated from anoda table called Sites)
    5. Rack: r01 (another set of string after the first "/")
    6.SubRack: sr01 (another set after the r01)
    7.Slot Number: sl22 (another set after the sr01)
    8.Port Number: daughter#01(ano ther set after the last"/")
    9.Release
    10.ANV Part Number: 3AL78848BAAH01

    Note, not all the columns will contain information at this time.

    This is what i want to achieve in access 2000. Each section (i.e all the contents before the long dashes (-----------------------------------------) sign should be on a row in the table created. This will be done for all the sections in all the txt files.

    I hope this is clear enough for now. Pls can anybody help me achieve this.
    Thank you.
  • LifeEquals42
    New Member
    • Jul 2006
    • 7

    #2
    [QUOTE=Jamad]I want to extract some information in a text file that is not tab, comma and space separated.

    Do you need help reading the text file?
    Is the format of the file always like this?

    USER LABEL : Intel_dub/r01sr1/board#02
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Date (00) : 03/03/07
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    USER LABEL : Intel_dub/r01sr1/board#03
    Unit type : A21E1
    Unit part number : 3AL78832AAAE02
    Software part number : --------------
    Serial number : CL030803249
    Date (00) : 03/03/13
    OPERATOR INVENTORY DATA
    ----------------------------------------------

    Comment

    Working...