Then you need a MID to get the portion of the ODBC string from the first InStr to the 2nd.
Something like this should do it ...
Public Function InStrDSN(strIn As String) As String
Dim intDSN As Integer
Dim intSemi As Integer
intDSN = InStr(1, strIn, "DSN=") ', stIn)
intSemi = InStr(intDSN, strIn, ";")
InStrDSN = Mid(strIn, intDSN, (intSemi - intDSN))
End Function
hth,
Steve Conklin
To: MS_Access_Professionals@yahoogroups.com
From: no_reply@yahoogroups.com
Date: Mon, 23 May 2011 23:18:33 +0000
Subject: [MS_AccessPros] InStr Function
What is the best way to capture an in string? Here is what we need...
String Example:
ODBC;DSN=BUSPROD;DBQ=BUSPROD;DBA=W
String Needed:
DSN=BUSPROD
This string can change. For example, it will need to be dynamic as another possibility could be "BUSDEV", etc. We need the string value between "DSN=" and the first instance of ";".
Thanks in advance!
Mike
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)
<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Tidak ada komentar:
Posting Komentar