Re: Cycling numbers and too few variables error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"=?Utf-8?B?Q2hyaXN0YWFheQ==?=" <Christaaay@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in news:3D53C9B5-EA6A-49B2-AC7A-FE4A740F8278@xxxxxxxxxxxxx:

> So far i haven't been able to get the code to run successully from a
> form or through VBA.

What code? You have some VBA, you have two SQL queries. We know that one
of the SQL queries is causing an error, but you haven't said which!


> I've double checked the fields and they are all
> there and spelled correctly.

Okay...

> One query that could be the issue isbelow.


SELECT
Last(tbl_Email_Data.Count_ID) AS LastOfCount_ID,
tbl_Email_Data.queue_key

FROM tbl_AssocTbl
INNER JOIN tbl_Email_Data
ON tbl_AssocTbl.Queue = tbl_Email_Data.queue_key

WHERE tbl_AssocTbl.cycled_ind = True
AND tbl_Email_Data.request_type Not In ("rt14")

GROUP BY tbl_Email_Data.queue_key

HAVING tbl_Email_Data.queue_key Is Not Null

ORDER BY Last(tbl_Email_Data.Count_ID);


This is presumably the qryGetQueueRoutingCycle querydef. I cannot see
what might be wrong with it, but LAST() is a function I very rarely use.
I don't see how it could produce a sensible result unless the recordset
was sorted on the ORDER BY clause before the grouping of the GROUP BY
clause, and I don't think that is true. The function does not seem to
exist like this in any real database language. As I asked above, does
this query [a] run successfully from the UI (double-click it in the
Database window), and [b] give the right answers?

> thoughts?

When you have to jump through hoops like this to get to a fairly simple
fact ("Who has been rostered recently?"), then I start to wonder about a
Major Design Problem...


B Wishes


Tim F

.



Relevant Pages

  • Re: Complex Subquery: ...FROM(TRANSFORM... systax - (fixed linebreaks)
    ... No, I'm not stuck. ... create another table to hold the items that were in the IN clause ... It is table H82 in the following disguised query tree. ... > messages then I think you are stuck unless you use some VBA to get the ...
    (microsoft.public.access.queries)
  • Re: filter show all
    ... Consequently, if you put *anything* in the Criteria row under your field, it excludes the Null values. ... It is possible to craft a WHERE clause to return True if there's no match. ... Just before the end of that article, there is an example of how to do it in the query instead of via VBA if you really want to. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Using 2 form fields as one criterium
    ... when you concatenate the form references in a query, ... this will give you a WHERE clause in the SQL statement that is essentially ... i can't think of any way to do this without using VBA to write the SQL ...
    (microsoft.public.access.queries)
  • list of numbers stored as text in a table cell as the criteria for a query?
    ... clause of a query. ... I think there should be a quick way of doing this without resorting to ... VBA, but I can't think what it is. ...
    (microsoft.public.access.queries)
  • Re: Merging content from access
    ... My hunch at the moment is that this is a problem in my access query. ... I agree with you that Word VBA is a more elegent solution. ... The other field-based technique requires you to have a "parent" table as ... the mail merge data source and a child table inserted using a DATABASE ...
    (microsoft.public.word.docmanagement)