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"

Recommended Answers

All 4 Replies

Welcome to the forums John.
Glad to have you here!

Hi John:
Welcome.
Feel free to post your inquiry in the appropriate forum here.

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.

Welcome to Daniweb forums....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.