0

Hi my name is John from I U.K.. Have only recently got back into progarmming following the death of my wife in April this year, so could really do with help on a few things I am trying at the mo!
Other than computers my other interests are my lovely American Bulldod, Dixie, music(Bowie/Pistols/Nirvana/Paul Weller and all things goth!!), fishing and long walks in the countryside.. Anyway, the immediate problem I have is building an SQL string with possible parameters, but I get a missing operator error when I try and open the recordset. The code is as follows. The choice parameter is a radio button choice. I haven't got as far as passing dates yet. Please could someone help.

Kind Regards
John

'---------------------------------------------------------------------------
' Function: strbuildSQLstr
' Purpose: Build SQL String to retrieve ADO Recordset
' Paramters: strChoice- string(Good or Bad),strStart- string(start date)
' strEnd - string( End Date)
' Returns: String - SQL Statement build with parameters passed
'---------------------------------------------------------------------------
Function strbuildSQLstr(strChoice As String) As String
Dim strtemp As String

strtemp = "Select * from SizeRange Where Style =" & "'" & txtStyle & "'"
If strChoice > "" Then strtemp = strtemp & "'" & " and WHERE type =" & "'" & strChoice & "'"

' return the SQL String
strbuildSQLstr = strtemp & " " & "ORDER by Date"

5
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by sreein1986
0

Nice of you to join, hope you'll be with us for a lifetime! Sorry to hear about the passing of your wife. We'll be willing to help, once you post your query in the programming section of this forum.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.