No value given for one or parameters in Report----HELP

I am using VB 6 and an Access DB.  I am wanting to run a query-based report which is determined by the user.
I have tried to use the SQL command:

Select * from TABLE where FIELD = [E];

and declare EE as a parameter and then

set EE= text1.text

in order to fire the SQL..  I have also tried to use Querydef and define the  query in the Database and then set the querydef's parameter = the text1.text but neither has worked.  

The first method I tried gave the error "NO value given for one or more parameters"

Please help me

Who is Participating?
CrutoyConnect With a Mentor Commented:
I don't think these answers are going to work. E is a parameter. Therefore  you need to use if you using Dao QueryDefs object and open a parameter collection on it.
Something like this will work.

Dim qf As QueryDef
Set qf = dbsRemote.QueryDefs("QueryName")
qf.Parameters(e) = "<valeu>"
then you retrieve a recordset if needed.
Set qf = Nothing
Bob LearnedCommented:
How are you using the SQL statement?

You could use 'SELECT * FROM Table WHERE Field = '" & Text1.Text & "'"
dim ee as string
ee = text1.text
dim strSql as string
strSql = "Select * from YourTable where YourField = 'ee'"
YourDataControl.RecordSource = strSql

Bob LearnedCommented:
All I was saying was that you could construct a SQL statement that wouldn't need a parameter, and the recordset could be opened easily from the VB program, instead of storing a query in the database.
johnmhatAuthor Commented:
Thank you all for the response, I haven't been able to try your answers as of yet but I am sure your help will help me to get it going----I hope
All Courses

From novice to tech pro — start learning today.