Using InSTR Function


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Using InSTR Function

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Using InSTR Function

    [Originally posted by Walter Cantrell]

    I take the last name from a field in a database then insert a comma and a blank and insert the firstname from the same database and add this as an item in a combo box.

    When someone chooses a name I then want to re-separate this back into first and last name and assign each to its own string for purposes of updating the database based on these 2 fields.

    I think I would use the instr function but not exactly sure how.

    Thanks for any help,
    Walter

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Using InSTR Function

    [Originally posted by Kumar]

    Hi Walter Cantrell,
    Here is the syntax to seprate the First Name and Last Name.
    ex :
    Dim strName as string,FirstName as string,LastName as string
    strName=combo1.text

    '''U add the Last Name before the seperater ","
    LastName=mid(strName,1,instr(1,sName,",")-1)

    '''First Name after the Seperater ", "
    FirstName=mid(sname,instr(1,sname,", ")+2)

    with regards.,
    Kumar.K

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Using InSTR Function

    [Originally posted by Walter Cantrell]

    Works great! Thanks.

    Walter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center