Passing a varibale from form to Query OF Access in SQL View

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am storing a value from text box to a variable . and Now I have to pass this value in Query of MSAccess ( SQL View )

on Command button I have written
This Code is written in the FOR

query = "Name = 'vijay'
stDocName = "Detail_query
DoCmd.OpenQuery stDocName, 1, query ( passing the value name = " Vijay" in query

and In Detail_ Query I have written

SELECT
FROM details where [form].[query]

Can anyone guide me in what Code should be written as I am getting an error in form Type MISMATCH

I would highly appreciate in someone can help me

Thanks in Advance for all who have to tried to get this solve.
 
Hi,


Your WHERE clause does not look right. The syntax for a value is either

TableName.FieldName


either


FORMS!FormName!ControlName


and it generally implies a condition ( a comparison with something).


If you try with


SELECT * FROM details


that works? If you need some improvement to design, WHAT are you trying to
do (you already tell HOW , but nothing about WHAT ) ?



Hoping it may help,
Vanderghast, Access MVP


Vijay said:
I am storing a value from text box to a variable . and Now I have to pass
this value in Query of MSAccess ( SQL View ) .
on Command button I have written
This Code is written in the FORM

query = "Name = 'vijay'"
stDocName = "Detail_query"
DoCmd.OpenQuery stDocName, 1, query ( passing the value name = " Vijay" in query"

and In Detail_ Query I have written

SELECT *
FROM details where [form].[query];

Can anyone guide me in what Code should be written as I am getting an error in form Type MISMATCH.

I would highly appreciate in someone can help me.

Thanks in Advance for all who have to tried to get this solve.
 
Back
Top