-
WSJailAdmin
AskWoody LoungerI am using a query (qryLine1) with the date selected based on the date of incident, Floor and an expression for floor which counts the number of entries by floor between dates. Three fields to select.
I am using one stored query, I don’t want to write a different query for each box when all I need to do is to change the filter for the different floor. I don’t know how to make an SQL string. I can write the query and view the SQL but how do I move that to the report? There will be 88 boxes on the report when done and I don’t want to make a query for each one. I just believe access has a way to change the filter option alone for the text boxes in the report but I don’t have any idea on how to do it. Maybe I am wrong.
SELECT Count(DateSerial(Year(Date()),Month(Date()-1),0)) AS Numbers
FROM tblViolation
WHERE (((tblViolation.[Date of Incident]) Between DateSerial(Year(Date()),Month(Date()-1),0) And DateSerial(Year(Date()),Month(Date())-1,0)))
GROUP BY tblViolation.Floor
HAVING (((tblViolation.Floor)=”13″))
ORDER BY tblViolation.Floor DESC;I can copy and paste this into the data control source but it only lists the first line and gives me an error: Extra ) in query expression…
I have counted, carefully, the brackets and there are the same number of opening and closing, plus I copied the expression straight from the SQL view and pasted it in.
-
WSJailAdmin
AskWoody LoungerI am not a pro at this but I think I can answer this for you.
To subtract two days you need to enclose the dates in a bracket, [Return Date]-[Ship Date].
The second is done by using sort, I presume you are using a query, in the Sort row set it to Ascending/Descending and set a filter for the month only.
-
WSJailAdmin
AskWoody LoungerYes, that did it.
Thank You vVery Much.
I do not know what the functions do in Excel and rely on trial and error.
-
WSJailAdmin
AskWoody LoungerThat is almost it. Is there a function that reverses this and counts NonBlanks?
-
WSJailAdmin
AskWoody LoungerI’m sorry, I was not clear, all the cells will either be empty or will have a name in them. The text is the name.
-
WSJailAdmin
AskWoody LoungerYes, I need to list the staff that are sick, on vacation, etc. If there is a name in the column they are out for the reason and I need a count of these. But if there is no name listed then I don’t want to count that box.
-
WSJailAdmin
AskWoody LoungerThanks, That did it.
JAM
-
WSJailAdmin
AskWoody LoungerThank You so much. I couldn’t see the forest for the trees with this. It worked of course.
Jail Administrator Medical
-
WSJailAdmin
AskWoody LoungerI am not sure if this is what you mean, but if you haven’t done so you might try going to Tools – Options – Edit/Find and uncheck in the Confirm Box the “Record Changes” Option.
Jail Administrator Medical
-
WSJailAdmin
AskWoody LoungerI see, It seems to work now, but what is the Case statement.
When the data is accepted from the form and the user clicks on the close button I want it to run. But with what you sent me I think I am able to get it done. Thank You.
JAM
-
WSJailAdmin
AskWoody LoungerThis is very helpful, and I even understand what the code is doing, but how would I go about clicking more than one box and having the reports print out on close of the record instead of ever time I click, or unclick, the field?
-
WSJailAdmin
AskWoody LoungerThank You very much. This does exactly what I need for the Printing of the Yes and No.
JAM
-
WSJailAdmin
AskWoody LoungerGo to the Table in Design mode. Change the Data Type to Text.
Make sure the Field Size, in the big box below, is at least 10 to allow for the 5 zip, the “-” dash and the Plus 4.
JAM
-
WSJailAdmin
AskWoody LoungerAugust 26, 2002 at 12:31 pm in reply to: Qry table to find records listed in other table (A2K XP) #611440As I see this it would obliviate the need for the queries I now use. I think.
What I have now are the following tables, I have simplified the previous for clairties sake.
tblInmates (it is a jail) which have Autonumber, Name, Location, Date of Birth, Date of Arrest, Allergies, Doctor, Arresting agency and Flag field.
tblMed which have ID (link to inmate, Med Name, Dose, Frequency of administration, Start Date, length of order, Stop Date, Discontinue and refill flags.
Do I need to make a tblCondition for the eight reportable conditions and give them an ID? Looks easy enough as there are only the eight.
How does the tblConditionMedicaine come in? Do I list the individual medications with the conditions they are used to treat? Would this just be two numbers in a table (ConditionID and MedicaineID) side by side? Would there be duplicates in the medicationID field for the multiple uses for the medications?
tblMedicaine I already have (called tblFormulary). How do I link the tables to generate the report?
Could you send a small example if possible? I am a visual person and the descriptions are sometimes difficult to follow.
Thank You for your time and effort, I know I am fairly new at this but there is no one here that even knows how to get started with Access and I am it by default. The jail has over 2400 inmates and about half of them are on one or more medications so it is important to us here to get the information as automated as possible.
JAM
-
WSJailAdmin
AskWoody LoungerAugust 26, 2002 at 12:04 pm in reply to: Qry table to find records listed in other table (A2K XP) #611430What I do now with the query is to look-up everyone who takes certain medications, if they take the psych medications, I print a report quarterly listing their personal information and the medications they are taking. The same for the other reportable classes of medications. (Asthma, pregnancy, high blood pressure, psych, diabetes, seizure, stomach and medical are the reportable conditions.)
My present query looks for the medications and if found it flags a Yes/No field on the patients main information table. I have a report that gathers all the information and prints the reports. Then sets the flag back to No. This is all the Yes/No field does is to act as a flag for printing reports.
What I am trying to do is to list the medications that are now in the condition field of the query in a table instead. This way I could update the table as medications for the different conditions are added or deleted without going into the query and editing the condition field. If a new diabetic medication is approved and added to our formulary, which happens frequently, I could just add a medication to the bottom of the Cdiabetic table and it would then be included in those medications we must report on and the query would be updated easily. Now I must edit the condition field of the query and I have run into very long conditions that Access is saying are too complex, (too long I think as some conditions have very many medicaions used to treat them.)
Is there a simpler way to do this? I am trying to make it as simple as possible and thought setting a list in a table would be the easiest way to list all the medications.
Some medications are used in the treatment of many different conditions, an example would be Depakote which is used to treat seizures, depression, Bi-Polar (Manic Depressive) and anger. It would then fall into two different reportable categories.
I hope this is clear and if I am on the wrong track please point me in the right direction.
Jail Administrator Medical
JAM
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
KB5061768 update for Intel vPro processor
by
drmark
55 minutes ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
1 hour, 57 minutes ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
12 hours, 58 minutes ago -
Office gets current release
by
Susan Bradley
17 hours, 41 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
1 day, 10 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
18 hours, 44 minutes ago -
Stop the OneDrive defaults
by
CWBillow
1 day, 11 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 day, 20 hours ago -
X Suspends Encrypted DMs
by
Alex5723
1 day, 23 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
1 day, 23 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
2 days ago -
OpenAI model sabotages shutdown code
by
Cybertooth
2 days ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
1 day, 12 hours ago -
Enabling Secureboot
by
ITguy
1 day, 19 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
2 days, 8 hours ago -
No more rounded corners??
by
CWBillow
2 days, 4 hours ago -
Android 15 and IPV6
by
Win7and10
1 day, 18 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
2 days, 20 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
2 days, 23 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
2 days, 18 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
3 days, 6 hours ago -
May preview updates
by
Susan Bradley
2 days, 18 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
2 days, 9 hours ago -
Just got this pop-up page while browsing
by
Alex5723
2 days, 23 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
2 days, 20 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
1 day, 22 hours ago -
At last – installation of 24H2
by
Botswana12
3 days, 22 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
20 hours, 13 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
4 days, 10 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
2 days, 9 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.