PC Review


Reply
Thread Tools Rate Thread

Define text record with fields of defined length

 
 
DianePDavies
Guest
Posts: n/a
 
      22nd Oct 2009
I have a text file where I read one line at a time.
I would like to define a data type like:

Type DataRec
Rectype as string(2)
name as string(12)
adress1 as string(30)
..
..
end type

dim DR as DataRec

by assigning the input line to a variable of the type DataRec I would like
to be able to get to the individual fields like:

name = DR.name

where DR.name is then having the appropriate value.

How do I define variable of a certain string-length?

--
Diane
 
Reply With Quote
 
 
 
 
Stuart McCall
Guest
Posts: n/a
 
      22nd Oct 2009
"DianePDavies" <(E-Mail Removed)> wrote in message
news:15FE4B10-358E-4F96-81D2-(E-Mail Removed)...
>I have a text file where I read one line at a time.
> I would like to define a data type like:
>
> Type DataRec
> Rectype as string(2)
> name as string(12)
> adress1 as string(30)
> ..
> ..
> end type
>
> dim DR as DataRec
>
> by assigning the input line to a variable of the type DataRec I would like
> to be able to get to the individual fields like:
>
> name = DR.name
>
> where DR.name is then having the appropriate value.
>
> How do I define variable of a certain string-length?
>
> --
> Diane


Type DataRec
Rectype as string * 2
name as string * 12
adress1 as string * 30
..
..
end type

PS use something other than 'name' - that's a reserved word in Access and
will confuse things sooner or later.


 
Reply With Quote
 
DianePDavies
Guest
Posts: n/a
 
      23rd Oct 2009
now with my data structure defined - I would like to read my input record
"through" this data structure.

I read my text file line by line into a string called IDR and then I try this:

Dim IDR As String 'input data record
Dim DRp As DR1 ' data record - project

LSet DRp = IDR

DR1 is my user defined type of a certain length. The LSet statement results
in a "Type mismatch" error.

How do I get my input data into my data struture variable?



--
Diane


"Stuart McCall" wrote:

> "DianePDavies" <(E-Mail Removed)> wrote in message
> news:15FE4B10-358E-4F96-81D2-(E-Mail Removed)...
> >I have a text file where I read one line at a time.
> > I would like to define a data type like:
> >
> > Type DataRec
> > Rectype as string(2)
> > name as string(12)
> > adress1 as string(30)
> > ..
> > ..
> > end type
> >
> > dim DR as DataRec
> >
> > by assigning the input line to a variable of the type DataRec I would like
> > to be able to get to the individual fields like:
> >
> > name = DR.name
> >
> > where DR.name is then having the appropriate value.
> >
> > How do I define variable of a certain string-length?
> >
> > --
> > Diane

>
> Type DataRec
> Rectype as string * 2
> name as string * 12
> adress1 as string * 30
> ..
> ..
> end type
>
> PS use something other than 'name' - that's a reserved word in Access and
> will confuse things sooner or later.
>
>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Define user-defined fields in View? zSplash Microsoft Outlook Calendar 1 10th Sep 2006 02:28 PM
Fixed Length Text fields Mervyn Thomas Microsoft Excel Programming 2 7th Mar 2006 02:33 PM
Parsing a fixed length record into fields =?Utf-8?B?Sm9obiBC?= Microsoft VB .NET 3 6th Apr 2005 11:45 PM
I inserted a max. length in text fields, but when I reopened the . =?Utf-8?B?QW1hbmRhMjM0?= Microsoft Word Document Management 1 12th Nov 2004 11:28 AM
length of text fields Nessa Microsoft Access 2 2nd Dec 2003 06:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:01 PM.