I keep getting an error with this code:


Dim Problem As String
Dim StringLength As Integer
Dim TempString As String

Problem = Left(TempString, StringLength)

When the program gets to this, it gives the error:
Object not a collection.

TempString = "ACT|Aircare team"
StringLength = 3

I should've went to bed an hour and a half ago, but I need to finish
this!

Re: Embedded VB Question about the Left function by Kevin

Kevin
Fri Feb 06 01:50:58 CST 2004

Never mind. I figured it out. It's one of the many bugs. You have
to use 'Mid' instead.

On Fri, 06 Feb 2004 07:25:02 GMT, Kevin <kevinp@remove_cfl.rr.com>
wrote:

>I keep getting an error with this code:
>
>
>Dim Problem As String
>Dim StringLength As Integer
>Dim TempString As String
>
>Problem = Left(TempString, StringLength)
>
>When the program gets to this, it gives the error:
>Object not a collection.
>
>TempString = "ACT|Aircare team"
>StringLength = 3
>
>I should've went to bed an hour and a half ago, but I need to finish
>this!


Re: Embedded VB Question about the Left function by Mike

Mike
Fri Feb 06 07:32:19 CST 2004

Yes, Left() only works in module code apparently. If you have it in form
code, eVB assumes that you mean the left property of the form.

Mike

"Kevin" <kevinp@remove_cfl.rr.com> wrote in message
news:qph620huiq4kcsma67olcgl6e5qahf80pg@4ax.com...
> Never mind. I figured it out. It's one of the many bugs. You have
> to use 'Mid' instead.
>
> On Fri, 06 Feb 2004 07:25:02 GMT, Kevin <kevinp@remove_cfl.rr.com>
> wrote:
>
> >I keep getting an error with this code:
> >
> >
> >Dim Problem As String
> >Dim StringLength As Integer
> >Dim TempString As String
> >
> >Problem = Left(TempString, StringLength)
> >
> >When the program gets to this, it gives the error:
> >Object not a collection.
> >
> >TempString = "ACT|Aircare team"
> >StringLength = 3
> >
> >I should've went to bed an hour and a half ago, but I need to finish
> >this!
>



Re: Embedded VB Question about the Left function by paulnewton44

paulnewton44
Mon Feb 09 03:40:06 CST 2004

Further on this subject:

What you could do is create a bespoke function in a "code module" that
uses the inherent eVB Left() function and then call this from wherever
you want in your application.

e.g.

Public Function CELeft(StrText As String, IntLength As Integer) As
String
' Purpose : Returns the first IntLength chars of a string
' In : StrText - the string to extract chars from
' : IntLength - the number of chars to extract
' Out : The extracted string
' Note : This function was written because the std Left()
function does not work on eVB forms,
' but it does work in code modules!

CELeft = Left(StrText, IntLength)

End Function

Hope this helps..


Paul Newton


"Mike" <test@test.com> wrote in message news:<es#CgWL7DHA.712@tk2msftngp13.phx.gbl>...
> Yes, Left() only works in module code apparently. If you have it in form
> code, eVB assumes that you mean the left property of the form.
>
> Mike
>
> "Kevin" <kevinp@remove_cfl.rr.com> wrote in message
> news:qph620huiq4kcsma67olcgl6e5qahf80pg@4ax.com...
> > Never mind. I figured it out. It's one of the many bugs. You have
> > to use 'Mid' instead.
> >
> > On Fri, 06 Feb 2004 07:25:02 GMT, Kevin <kevinp@remove_cfl.rr.com>
> > wrote:
> >
> > >I keep getting an error with this code:
> > >
> > >
> > >Dim Problem As String
> > >Dim StringLength As Integer
> > >Dim TempString As String
> > >
> > >Problem = Left(TempString, StringLength)
> > >
> > >When the program gets to this, it gives the error:
> > >Object not a collection.
> > >
> > >TempString = "ACT|Aircare team"
> > >StringLength = 3
> > >
> > >I should've went to bed an hour and a half ago, but I need to finish
> > >this!
> >