Re: Need to get result of a select query in code
- From: John W. Vinson <jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 20 Jan 2008 19:56:30 -0700
On Sun, 20 Jan 2008 20:07:54 -0500, "Robert" <cpq1bcle[REMOVE]@verizon.net>
wrote:
The problem is that it's a nested query with 2 where clauses. I was
thinking along the lines of using a string and concatenating in these 2
variables. But the currentdb.execute or docmd.runsql approach rejects
select queries. So I was wondering if there was any way a select string
could be executed in code without creating a recordset. Maybe not.
If you can save the query, you can use DLookUp to look up a value in the
query.
You do not need to, nor should you, "run" or "open" the query to do so. Just
xyz = DLookUp("[fieldname]", "[queryname]")
will do, if the query returns only one record.
A Recordset may well be better, especially if your query returns more than one
record or if you want to retrieve more than one field from the record.
John W. Vinson [MVP]
.
- Follow-Ups:
- Re: Need to get result of a select query in code
- From: Robert
- Re: Need to get result of a select query in code
- References:
- Need to get result of a select query in code
- From: Robert
- Re: Need to get result of a select query in code
- From: John W . Vinson
- Re: Need to get result of a select query in code
- From: Robert
- Need to get result of a select query in code
- Prev by Date: Problem with .addnew
- Next by Date: Re: SQL string longer than 255 characters
- Previous by thread: Re: Need to get result of a select query in code
- Next by thread: Re: Need to get result of a select query in code
- Index(es):
Relevant Pages
|