Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1

    Unanswered: Queries and the Length Function

    Back again, and still confused!

    In a query, I want to count the number of "A"s in a particular field, and then add up the total. Teachers can place one "A" or 2 "A"s in a field (some courses are held twice a week), and there is one field for each of 20 weeks (i.e. 20 string fields). Not my design. Should be simple:

    absences: len([a1]) + len([a2])+ len([a2]) ....(etc) where [a1] is a string field for absences in week 1.

    Won't work in a query. I can get the length function to read the field size (though this is perhaps erratic), but I cannot add them up (results are erratic.).

    I tried to create a user defined query to carry out this function (in a module). Access did not like this either. Can user defined functions be used in queries?

    Regards

    John S

    Quangxi U (presently)
    Nanning
    China

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Look at "DemoLenQryA2000.mdb" (attachment, zip).
    Look at Table1, Query1, Module1.
    Adapt it in your mdb.
    Attached Files Attached Files

  3. #3
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1
    Ah, how clever. Thanks. Time to learn a bit about the NZ function I guess.

    Thanks again,


    John S

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •