• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

need help with the mid and instr functions

I'm trying to use the mid and instr functions to pull a substring from a string like this example:

"JTTTT0645T383"TUCKER, JAMmES"9999999999999999999999999""6/27/2037"""1/1/1900""

I would like to receive this value:
JTTTT0645T383

The string ALWAYS begins w/ quotes and is ALWAYS delimited with quotes. I need the first value within the quotes returned.

please give me some ideas, thanks
0
vindog26
Asked:
vindog26
1 Solution
 
PaulHewsCommented:
You could use Split:

Dim strSplit() As String
strSplit = Split(strTest, """")
MsgBox strSplit(1)

You could also use Mid$ and Instr as follows:

MsgBox Mid$(strTest, 2, InStr(2, strTest, """") - 2)
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Left(YourString, Instr(1,YourString,Chr(34))-1)

try that ...

mx
0
 
Rey Obrero (Capricorn1)Commented:
where is this substring coming from?

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jkrCommented:
You could just

#include <string>
using namespace std;

int pos1,pos2;

string str = // your string

pos1 = str.find('\"');
pos1 = str.find('\"', pos1 + 1);

string result = str.substr(pos1 + 1, pos 2 - pos1 - 1);
0
 
Infinity08Commented:
Access
C++
Visual Basic

Which one is it ?
0
 
vindog26Author Commented:
I actually had to go w/ this.
Mid$([val], 1, InStr(2, [val], """") - 1)
 but close enough, thankx!
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now