: : Why are you storing SQL-Statements with Parameters in your Database?
: : IMHO it's much easier to create the SQL-Statement in your Code and
: : then execute it directly.
: :
: : Example:
: : Dim SQLString as String
: : Dim Begin as Date
: :
: : 'Fill Code in here to get a valid Date
: :
: : SQLString="SELECT * FROM Customers WHERE DateMemberShip>#" & Begin &
: : "#"
: :
: : DB.OpenRecordset(SQLString,dbOpenDynaset) <-- This is a Statement
: : from DAO, not ADO but i think you get the Idea
: :
*snipp*
: :
: : ------------------------------------------
: : Only stupidity of mankind and the universe
: : are infinite, but i'm not sure concerning
: : the universe. A. Einstein
:
: Hello Barkeeper,
:
: at first thanks for the replay, but, I have a programm that is
: beeing used by someone(s) that doesn't know how to make a sql
: statement, so I give him (them) a listbox with all kinds of
: statements and the purpose off them.
: When the user select the statement just the date should be filled in
: to execute the statement, altough that's the idee.
: Cheyenne
:
OK, but that's still not a reason to store the SQL-Statements as procedures in the DB.
Gathering from your words, your offering on your form a List with generic SQL-Statements (e.g. the SQL-Statement as above with after selecting it in the Listbox a Input-Box popping up asking for a valid date). Why not treat the Items in your ListBox just as Strings? After hitting an item in the ListBox your code (to which the user doesn't have access to!!!) proccesses something like this:
Sub ListBox_Click(ByVal Index as Integer)
Dim SQLString as String
Dim InputDate as String 'Or Date - whatever you prefer
SQLString=ListBox.Text
InputDate=InputBox("Input a valid Date")
'Fill in some code to validate InputDate such If Not IsDate(InputDate) then DoSomething
SQLString=SQLString & InputDate
Set RS=DB.OpenRecordset(SQLString,dbOpendynaset)
End Sub
------------------------------------------
Only stupidity of mankind and the universe
are infinite, but i'm not sure concerning
the universe. A. Einstein