I need to grab the last 6 Characters in a text box 
Author Message
 I need to grab the last 6 Characters in a text box

I have an application where I need to extract the last 6 Characters of a
string in a text box, and copy those 6 characters to a separate text box. Can
anyone help?

Also, is there a way to search on several or all fields in a Access database?



Kodak Park
Bldg.23, 8th floor, MC:24394
Rochester, NY 14652-4394
Phone:(716)477-0124  FAX:(716)588-3217



Fri, 22 Aug 1997 21:06:19 GMT  
 I need to grab the last 6 Characters in a text box

Quote:
>I have an application where I need to extract the last 6 Characters of a
>string in a text box, and copy those 6 characters to a separate text box. Can
>anyone help?

Text2 = right$(Text1, 6)

------------------------------------------------------------------------
Chuck Stuart - Mesquite TX USA  
VBTrace 2.00 is a runtime Procedure Trace/XReference/Debug/Profiler and
much more tool for VB and is now in beta. Download beta version 2.00.12
from ftp.apexsc.com/pub/cgvb/visitor.
------------------------------------------------------------------------



Sat, 23 Aug 1997 01:20:45 GMT  
 I need to grab the last 6 Characters in a text box

Quote:

> I have an application where I need to extract the last 6 Characters of a
> string in a text box, and copy those 6 characters to a separate text box. Can
> anyone help?

A function like this should do the trick

In Declarations . . .
---------------------
dim c as control

The function itself . . .
-------------------------
Function GetLastText (c as control) as string
    dim strTemp as string
    dim intChars as integer
    intChars = 6

    'make sure we're dealing with a textbox
    if TypeOf c Is Textbox then
        strTemp = c.text

        'make sure there are at leaste 6 character so that you don't
        'generate an error
        if len(strTemp<6) then
            intChars = 6
        endif

        'return the value to the function
        GetLastText = right$(strTemp,intChars)
    else
        'not a textbox so return nothing
        exit function
    endif
End Function

To use the function . . .
-------------------------
Set c to the textbox of your choice:

    Set c = Text1

Call the function . . .

    value$ = GetLastText(c)

That should do the trick for any textbox you've got; and it can be
easily modified for combo boxes, etc.

/Jamie Rubin/



Sat, 23 Aug 1997 02:59:26 GMT  
 I need to grab the last 6 Characters in a text box

Quote:

>I have an application where I need to extract the last 6 Characters of a
>string in a text box, and copy those 6 characters to a separate text box. Can
>anyone help?

box2.text = Right$(box1.text,6)

Quote:
>Also, is there a way to search on several or all fields in a Access database?

In VB:
SELECT .... WHERE Field1 LIKE '....' OR Field2 LIKE '.....' etc.

In Access:
Show the table, then hit the binoculars button to find data in any field.


** Leading a life of noisy desperation. **
My opinions and $0.75 will get you a cup of coffee.



Sun, 24 Aug 1997 00:12:37 GMT  
 I need to grab the last 6 Characters in a text box

Quote:

>Subject: Re: I need to grab the last 6 Characters in a text box

>Date: 6 Mar 1995 18:59:26 GMT

>> I have an application where I need to extract the last 6 Characters of a
>> string in a text box, and copy those 6 characters to a separate text box. Can
>> anyone help?

>A function like this should do the trick
>In Declarations . . .
>---------------------
>dim c as control
>The function itself . . .
>-------------------------
>Function GetLastText (c as control) as string
>    dim strTemp as string
>    dim intChars as integer
>    intChars = 6
>    'make sure we're dealing with a textbox
>    if TypeOf c Is Textbox then
>        strTemp = c.text

>        'make sure there are at leaste 6 character so that you don't
>        'generate an error
>        if len(strTemp<6) then
>            intChars = 6
>        endif

>        'return the value to the function
>        GetLastText = right$(strTemp,intChars)
>    else
>        'not a textbox so return nothing
>        exit function
>    endif
>End Function
>To use the function . . .
>-------------------------
>Set c to the textbox of your choice:
>    Set c = Text1
>Call the function . . .
>    value$ = GetLastText(c)
>That should do the trick for any textbox you've got; and it can be
>easily modified for combo boxes, etc.
>/Jamie Rubin/

Why not just come out and say this:

LookedForText = Right$(SearchedText, 6)

Heck of a lot simpler.

John.

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

President,
Raptor Systems
1813 Rugg Road
Nanaimo, BC V9R 5K2                           Tel: (604) 722-7041
CANADA!                                       Fax: (604) 756-6171



Tue, 26 Aug 1997 08:41:26 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Check the last character of a text box

2. grabbing text and displaying it in a text box

3. Grabbing text from another apps text box

4. HELP,HELP needed- grabbing text from text file

5. I need help replacing characters in a text box

6. I need help replacing characters in a text box

7. I need help replacing characters in a text box

8. I need help replacing characters in a text box

9. Rich Text box displaying last inserted text?

10. Copy Last entry on Combo Box to Text Box

11. How to strip the 1st and last character out of a line of text

12. Text from vba text box (>2000 characters) to a Word bookmard

 

 
Powered by phpBB® Forum Software