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

JOHN
johnmhatAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
How are you using the SQL statement?

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

0
CrutoyCommented:
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>"
qf.Execute
then you retrieve a recordset if needed.
Set qf = Nothing
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
0
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.