Recent content by dlhappy

  1. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    Hi: I tried it but it would not open and instead I got the following error message: The ORDER BY expression (IIf(Title='Total:','zzzz',LastName)) includes fields that are not selected by the query. Only those fields requested in the first query can be included in an OREDER BY expression. I...
  2. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    No it shows a total of 161. But just a count without the table listing of names, email addresses, etc. which is what I want, all combined - just a total at the bottom. I think I'll just use the sum symbol on the ribbon/menu and then I get what I want (suitable for exporting to Excel with the...
  3. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    Yes, sorry, I didn't realize that I didn't reply. Would you believe it, but I had to change your Post #16 from a link to plain text, above in the question, because it thought my reply was spam and would not let me reply. I Posting just that code by itself only relates to the count, and so I...
  4. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    Thanks. I received an error message: Syntax error in FROM clause. I tried it with and without the "." at the end of From qryMembershipUnion and I received the same error message with or without the ending "." This is the complete code with your addition: SELECT...
  5. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    Hi, although counting on last name only works (not the code) in datasheet view when I click on the ribbon summation key (and correctly, in that at the bottom of the datasheet table, it shows total 170, I could not in the code select LastName and FirstName because not all records have a name in...
  6. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    Thanks, but no, it doesn't work. The datasheet view shows one column "LastNamesCount" with the number 1 in each row, and only 28 records (there should be 170)
  7. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    Thanks. It doesn't open, Access returns the following error message: The specified field 'MembershipID' could refer to more than one table listed in the FROM clause of your SQL statement. Incidentally, I don't the the max of membership year (the last membership year for which the member paid...
  8. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    Thanks. I copied the code that you supplied and ran a test but the result only had one column, labeled LastNameCount and just the number 1 in each row for 161 records. That for some reason is not the correct number because my original query has the correct 170 records. Also, my original union...
  9. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    I didn't write any of it - I merely did an SQL view and copied and pasted them here: For qryMembershipNotArchivedEmailMailingList it is: SELECT qryMembership.Title, qryMembership.LastName, qryMembership.FirstName, qryMembership.Email FROM qryMembership WHERE (((qryMembership.Email)<>"" And...
  10. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    It Thanks for your reply. I think so. It must be this one FROM qryMembershipNotArchivedEmailMailingList. I guess that it must be caused by the Union query itself because one query/table contains that field (NonMemberID) whereas the other table does not (and should not). So when I just click...
  11. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    Thanks, that worked with this code in a separate query: SELECT Count(LastName) AS LastNameCombined FROM qryEmailListNonArchivedMembersANDNonArchivedNonMemberPurchasers; Just as an aside, I originally just had Count but Access indicated I needed SELECT and then it worked and when I looked at...
  12. D

    Need help with SQL in an Access query that has UNION for the non-relational queries/tables

    Please have patience with me. I not familiar with modern programming. I'm almost 81 years old and had two Fortran II classes at NYU in the mid 1960s. The most I do now are relatively simple batch files that I run from the command prompt on my desktop computer. I'm retired but am a membership VP...
  13. D

    Help Needed to SetFocus on Unbound Text Box in Form Header Section

    Thanks. It works now, but I think that what I have is something like that, although I'm not sure if the header section is actually a subform, because there are only text boxes, options, labels, etc., but no actual linked table in that header section.
Back
Top Bottom