Michael Bahr
jedi at charm.net
Fri Apr 22 12:33:43 CDT 2011
Chester, if you are still having trouble consider using the debugger. Stop on the line Test = Split(LineText) and view the contents of LineText to make sure there is something there. If there is a valid string then view the properties of Split(LineText), there should be a bunch. You may need to place them in the Inspection window. Goodluck, Mike... > I tried changing the dim statement to > Dim Test as Variant > > I then did > Test = Split(LineText) > Test2=Test(0) > > Both variables test and test2 are empty > I ran a LEN test on the variable LineText and got 98 > > I am puzzled. Thanks for everyone's help. > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust > Sent: Friday, April 22, 2011 10:56 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Trouble using Split command > > I see. You're trying to manipulate the resultant array before > assigning it to the variant variable. I don't think that will work, > even though it seems like it should. I suspect you're going to have > to assign the result to a variant and then use the 0 element of the > variant array to get what you want. I'd suggest you try that. > However, given the structure of the string you're working with, I > suspect you'll find that the resultant array has a whole bunch of > elements containing spaces. Try it the long way and see what you get. > You may be surprised by what is in element 0. > > Charlotte Foust > > On Fri, Apr 22, 2011 at 8:48 AM, Kaup, Chester > <Chester_Kaup at kindermorgan.com> wrote: >> My understanding is that the result of the split statement is a one >> dimensional array. Thus the Dim test() as Variant >> The Test = Split(LineText)(0) statement is meant to put the contents of >> the first array element into the variable Test. >> Correct me if I am wrong. >> >> -----Original Message----- >> From: accessd-bounces at databaseadvisors.com >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of philippe pons >> Sent: Friday, April 22, 2011 10:05 AM >> To: Access Developers discussion and problem solving >> Subject: Re: [AccessD] Trouble using Split command >> >> Better! >> >> Public Sub test() >> 'I have a dim statements as follows >> Dim LineText As String >> Dim test As Variant ' no parenthesis for the name of the variable >> LineText = " 0.000 >> 243.729 - 61.495 -" >> 'The split statement should be as follows >> test = Split(LineText, "0") ' the split separator must be within the >> () >> of the split function >> End Sub >> Philippe >> 2011/4/22 philippe pons <phpons at gmail.com> >> >>> Dim Test() As Variant >>> >>> Philippe >>> >>> 2011/4/22 Kaup, Chester <Chester_Kaup at kindermorgan.com> >>> >>> I am trying to use the split command on the following string >>>> >>>> " 0.000 243.729 >>>> - >>>> 61.495 -" >>>> >>>> I have a dim statements as follows >>>> Dim LineText As String >>>> Dim Test() As String >>>> >>>> The split statement is as follows >>>> Test = Split(LineText)(0) >>>> >>>> No matter how I dim Test() I get an error message of >>>> Run Time Error 13 >>>> Type Mismatch >>>> >>>> This seems like it should be real simple but I am obviously missing >>>> something. >>>> >>>> Thanks. >>>> >>>> >>>> >>>> >>>> Chester Kaup >>>> Engineering Technician >>>> Kinder Morgan CO2 Company, LLP >>>> Office (432) 688-3797 >>>> FAX (432) 688-3799 >>>> >>>> >>>> No trees were killed in the sending of this message. However a large >>>> number of electrons were terribly inconvenienced. >>>> >>>> >>>> -- >>>> AccessD mailing list >>>> AccessD at databaseadvisors.com >>>> http://databaseadvisors.com/mailman/listinfo/accessd >>>> Website: http://www.databaseadvisors.com >>>> >>> >>> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >