Hi People who make my life easier
,
I had trouble deciding where to post this thread so I apologize if it is misplaced.
I want to that the WHERE clause for a SQL statement that I am using options on a form to build. I intend to use the clause in opening a datasheet form.
This is the code I have for getting the substring
the value of intPos remains=0 and when the program hits the second to last line I get "run-time error 5"
Am I missing something really obvious here?
Thanks for the help.

I had trouble deciding where to post this thread so I apologize if it is misplaced.
I want to that the WHERE clause for a SQL statement that I am using options on a form to build. I intend to use the clause in opening a datasheet form.
This is the code I have for getting the substring
Code:
Dim intPos As Integer
Dim tempString As String
Dim BaseQueryFormStr As String
'BaseQueryFormStr is used to reopen the BaseMasterQueryFrm with the specified parameters
tempString = "WHERE"
intPos = InStr(1, strSQL, tempString, vbTextCompare)
BaseQueryFormStr = Left(strSQL, intPos - 1)
MsgBox (BaseQueryFormStr)
Am I missing something really obvious here?
Thanks for the help.