A REAL TOUGH QUERY!!
Posted on 1998-08-25
I am working with an access database. I am setting up a query form, where users can set their criteria in text boxes which are labelled. Now, I understand that I must evaluate
each and every textbox to see if it is valid and run a query on my access table.
Right now I am doing this:
Dim f_voltacmin As Integer
If voltacmin.Text = "" Then
' do nothing
f_voltacmin = voltacmin.Text
Set temprst = dse.Database.OpenRecordset("SELECT *" _
& " FROM MASTER" _
& " WHERE VOLTAGE_AC >= " & f_voltacmin & " OR VOLTAGE_AC_MIN >= " & f_voltacmin & " ")
Set dse.Recordset = temprst
and then I am running this again and again with different fields, I will modularize it later...
But I have realized that it opens up the table each and every time, and the previous SQL statement gets lost. Even though I have set the database recordset to the temp recordset. But I think when I fill in the SELECT and FROM, that is what screws it up. What I want to do is use the WHERE clause without the FROM, because I don't want to select the same table each time, I want to select my query up to date.
How can I execute multiple SQL expressions like above for the same table at different times? I need to execute them multiple times because I need to evaluate the user input, to see if I can do it or not.
What I essentially want to do is query my table, and query that query, query that subquery and so on until I am done.
How do I DO THIS!!!!
Thanks in advance...