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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expression in Query

Status
Not open for further replies.

Crookshanks

Technical User
May 18, 2004
296
NL
Goodafternoon,

I have got a small question. I am building a Form, and on that form a particular textbox (me.txtId.value) provides a value that I want to user in my Query:

SELECT tbl_Intresses.INTRESSE_ID, tbl_ObjectGroepen.CODE, tbl_ObjectGroepen.OMSCHRIJVING, tbl_Intresses.KANDIDAAT_ID
FROM tbl_ObjectGroepen INNER JOIN (tbl_Kandidaten INNER JOIN tbl_Intresses ON tbl_Kandidaten.KANDIDAAT_ID = tbl_Intresses.KANDIDAAT_ID) ON tbl_ObjectGroepen.OBJECTGROEP_ID = tbl_Intresses.OBJECTGROEP_ID
WHERE (((tbl_Intresses.KANDIDAAT_ID)='me.txtid.value'));

But after that the form is loaded the query does not run as expected. Also not when I am browsing through the records.

Q: Hoe can I provide that value on a form in a query (by means of an expression?)?

Any help appreciated, thanks in advance,
 
you need to use the full name of the textbox...

i.e.

forms("frmName").textbox

--------------------
Procrastinate Now!
 
Ok, I changed that into
WHERE (((tbl_Intresses.KANDIDAAT_ID)='forms("Kandidaten").txtId'));

But now I receive type mismatch error
I want to match on Primary Key (AutoNum) and the type of the textbox is just a general Number.

Q: Any idea what causes this and how ik can be solved.
 
Replace this:
WHERE (((tbl_Intresses.KANDIDAAT_ID)='forms("Kandidaten").txtId'));
By this:
WHERE tbl_Intresses.KANDIDAAT_ID=[Forms]![Kandidaten]![txtId];

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I am a new user to ms access and I have a quick question regarding queries. I have created a table with all of our companies existing contracts. Next I created several queries to search various fields in this table by utlizing:
Like "*" & [Search by Contract Type] & "*"

Is there anyway to have this pop up box list the (in a pull donw menu if sorts) possible types of contract the user has avaiable to search on?

Thanks so much!

krp7168
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top