Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Builder

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
Hi

I'm using the query builder in VB 6 and I'm a little stuck. I have selected the fields from two different tables that I require and placed the sort order, etc.

What I want to do is to only list values where an id field matches that of a variable on my form. In the criteria bit next to my field in the builder, I want to say something like "= MyVar" where MyVar is a variable declared on my form. I get the error "MyVar is not a part of the query".

Is there a way to list this? In Access you could set the criteria of a query to an object on your form such as a combo box so it only lists records that match that value.

Thanks for any help
Nora
 
post the line/s your getting error on. Tim

Remember the KISS principle:
Keep It Simple, Stupid! 8-)
 

Hi,

Post our code.
Your query should look somewhat like

Rst.open "SELECT * FROM TblMyTable WHERE MyField='" & MyVar & "'"


Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Hi

It's OK thanks people, I've got it now!

Thanks again
Nora
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top