-
WSLeesha
AskWoody LoungerGOT IT!!!! I finally cut and pasted your code in and it ran. I can’t thank all of you enough.
Have a grand day!
Leesha
-
WSLeesha
AskWoody LoungerHi Hans,
I tried something similar but noticed the following. First, the original form was unbound as were the two input boxes. The code ran as follows:
Dim ReportName
ReportName = “rptClientInitial-CopyInvoice”
DoCmd.OpenReport _
ReportName:=ReportName, _
view:=acViewPreview, _
WhereCondition:=”[Date] BETWEEN #” & _
Me.STARTDATE & “# AND #” & _
Me.ENDDATE & “#”When I tried to restrict the report by name and bound the form to the table with the client names, and bound the list to Client Name, I found that entering the code the way and you and Charlotte suggested no longer gives me the ability to find the names startdate or enddate when I type me. There are no start and end dates in the actual tables that are in the query the is bound to the report. The only date is the date entered as the billing date. When running the report I am trying to run the report for a date range that varies from report to report, etc.
Alicia
-
WSLeesha
AskWoody LoungerYAHOO!!!!!!!!!! That did it. I’m so thrilled.
Now, to get the restrictions on dates to work. As I mentioned earlier, I have two unbound list boxes, one labeled startdate and and one labeled enddate to restrict the time frame for the report. I tried the AND statement that Charlotte mentioned earlier but got errors. Any suggestions?
Alicia
-
WSLeesha
AskWoody LoungerUgh, I’ll admit with all the changes I didn’t declare strwhere, but added it and still receive the syntax error as written above. I don’t understand it. When I yank the code that refers to the docmd to open the report, I don’t get a blow up and the immediate box shows that the correct name is found. If I take out the ,,strwhere at the end of the code used to open the report, the report opens, but all clients are in the report.
Alicia
-
WSLeesha
AskWoody LoungerI tried adding the column piece and now at least in the debug screen it shows the name vs the ID number so we’re making progress! (Thank you for your patience). I am however still getting a syntax error and when I go to debug the portion hightlighted is as follows:
DoCmd.OpenReport “rptClientInitial-CopyInvoice”, acViewPreview, , strWhere
The entire code is as follows:
strWhere = “[Client Name] = ‘” & Me.List2.Column(1) & “”
Debug.Print strWhere
DoCmd.OpenReport “rptClientInitial-CopyInvoice”, acViewPreview, , strWhereThanks,
Alicia -
WSLeesha
AskWoody LoungerI am trying to restrict the report by client name not ID. The SQL behind the row source reads as follows:
SELECT tblClientDemographics.ID, tblClientDemographics.[Client Name]
FROM tblClientDemographics
ORDER BY tblClientDemographics.[Client Name];If I take out “ID” nothing shows in the list box (even after adjusting column settings etc.) If I replace “ID” for “client name” I get a similar error message. RE placing backets around Client Name when I did this prior to posting, the report opens however if it blank without ANY names let alone the name I’m trying to restrict it to.
I’ve removed the date restiriction piece at this point till I get the name piece straightened out but will try Charlottes suggestion after I ge this name restriction down.
Thanks,
Alicia -
WSLeesha
AskWoody LoungerHi Hans,
Thanks for the help. Did what you suggested and this is the error message that comes up before I get to the “immediate window”
“Syntax error (missing operator) in query expression ‘(client name =’15’)'”
This is the code its referringto
strWhere = “Client Name= ‘” & Me.List2 & “‘”
This is what is in the immediate window in the visual basic editor:
Client Name= ‘7’
Each time I select a different name from the list box the ID number changes so it is recognizing the change in name. Also, I tried replacing “client name” with “ID” but still get a similar error.
Thanks,
Alicia -
WSLeesha
AskWoody LoungerHi Charlotte! Thanks for the post. I tried the code you suggested but am still running into an issue. First, yes it was a list box on a form that I am referring to. The form is bound to tblClientDemographics and the list is bound to control source “ClientName”. I entered the code as follows:
strWhere = “ClientName = ‘” & Me.List2 & “‘”
DoCmd.OpenReport “rptClientInitial-CopyInvoice”, acPreview, , strWhere
My problem is that the report still opens showing all of the clients in the table.In addition to needing the report to open by client name, I need the report to open by a From and To date range. I have two input boxes on the form, one labeled “startdate” and one labeled “enddate”. I tried taking the code out for the dates to be sure that the report first opened by cient name but that didn’t help. The code I’m using for the dates is as follows:
Dim ReportName
ReportName = “rptClientInitial-CopyInvoice”
DoCmd.OpenReport _
ReportName:=ReportName, _
view:=acViewPreview, _
WhereCondition:=”[Date] BETWEEN #” & _
Me.STARTDATE & “# AND #” & _
Me.ENDDATE & “#”This code works fine.
Any suggestions would be greatly appreciated!!
Thanks again,
Leesah
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
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
-
Windows 11 Insider Preview Build 22635.5170 (23H2) released to BETA
by
joep517
55 minutes ago -
Has the Microsoft Account Sharing Problem Been Fixed?
by
jknauth
4 hours, 21 minutes ago -
W11 24H2 – Susan Bradley
by
G Pickerell
6 hours, 16 minutes ago -
7 tips to get the most out of Windows 11
by
Alex5723
4 hours, 17 minutes ago -
Using Office apps with non-Microsoft cloud services
by
Peter Deegan
10 hours, 25 minutes ago -
I installed Windows 11 24H2
by
Will Fastie
1 hour, 19 minutes ago -
NotifyIcons — Put that System tray to work!
by
Deanna McElveen
9 hours, 43 minutes ago -
Decisions to be made before moving to Windows 11
by
Susan Bradley
12 minutes ago -
Port of Seattle says ransomware breach impacts 90,000 people
by
Nibbled To Death By Ducks
17 hours, 58 minutes ago -
Looking for personal finance software with budgeting capabilities
by
cellsee6
2 hours, 11 minutes ago -
ATT/Yahoo Secure Mail Key
by
Lil88reb
2 hours, 25 minutes ago -
Devices with apps using sprotect.sys driver might stop responding
by
Alex5723
1 day, 11 hours ago -
Neowin – 20 times computers embarrassed themselves with public BSODs and goofups
by
EP
1 day, 19 hours ago -
Slow Down in Windows 10 performance after March 2025 updates ??
by
arbrich
21 hours, 51 minutes ago -
Mail from certain domains not delivered to my outlook.com address
by
pumphouse
1 day, 3 hours ago -
Is data that is in OneDrive also taking up space on my computer?
by
WShollis1818
1 day, 14 hours ago -
Nvidia just fixed an AMD Linux bug
by
Alex5723
3 days, 6 hours ago -
50 years and counting
by
Susan Bradley
4 hours, 35 minutes ago -
Fix Bluetooth Device Failed to Delete in Windows Settings
by
Drcard:))
7 hours, 24 minutes ago -
Licensing and pricing updates for on-premises server products coming July 2025
by
Alex5723
3 days, 17 hours ago -
Edge : Deprecating window.external.getHostEnvironmentValue()
by
Alex5723
3 days, 17 hours ago -
Rethinking Extension Data Consent: Clarity, Consistency, and Control
by
Alex5723
3 days, 17 hours ago -
OneNote and MS Word 365
by
CWBillow
3 days, 19 hours ago -
Ultimate Mac Buyers Guide 2025: Which Mac is Right For You?
by
Alex5723
3 days, 19 hours ago -
Intel Unison support ends on Windows 11 in June
by
Alex5723
3 days, 19 hours ago -
April 2025 — still issues with AMD + 24H2
by
Kevin Jones
1 day, 11 hours ago -
Windows 11 Insider Preview build 26200.5518 released to DEV
by
joep517
4 days, 7 hours ago -
Windows 11 Insider Preview build 26120.3671 (24H2) released to BETA
by
joep517
4 days, 7 hours ago -
Forcing(or trying to) save Local Documents to OneDrive
by
PateWilliam
4 days, 16 hours ago -
Hotpatch for Windows client now available (Enterprise)
by
Alex5723
4 days, 4 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.