Brindza Ervin
viner at EUnet.yu
Thu Aug 21 10:59:36 CDT 2003
----- Original Message ----- From: "Stuart McLachlan" <stuart at lexacorp.com.pg> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Thursday, August 21, 2003 2:21 PM Subject: Re: [AccessD] Detect the folder where the application resides > On 21 Aug 2003 at 12:41, Brindza Ervin wrote: > > > Stuart, > > many thanks for the quick help, but there is no function called InStrRev. > > Can you post it? > > Best regards, > > Ervin > > > You must be using A97. InstrRev was introduced in A2K. > > For A97, you can roll your own: > > Function InstrRev(Targetstring as String, Delimiter as String) as > String > Dim strTemp as String > strTemp = TargetString > While Right$(StrTemp,1) <> Delimiter And Len(strTemp) >1 > strTemp = Left$(strTemp,Len(strTemp -1) > Wend > InstRev = StrTemp > End Function > > Stuart, the code is great, it works in A97(I'll try on A2K and AXP also) but I made some minor changes. Many, many thanks again and have a great weekend Ervin Static Function ApplDir() As String Dim strApplDir As String Dim strTemp As String If strApplDir = "" Then strTemp = DBEngine(0)(0).Name 'Stuart strApplDir = Left(strTemp, InstrRev(strTemp, "\")) strApplDir = InstrRev(DBEngine(0)(0).Name, "\") End If ApplDir = strApplDir End Function Function InstrRev(Targetstring As String, Delimiter As String) As String Dim strTemp As String strTemp = Targetstring While Right(strTemp, 1) <> Delimiter And Len(strTemp) > 1 'Stuart strTemp = Left$(strTemp,Len(strTemp -1) strTemp = Left(strTemp, Len(strTemp) - 1) Wend InstrRev = strTemp End Function