-
WSRNCIENG
AskWoody LoungerThanks Hans.
-
WSRNCIENG
AskWoody LoungerHans,
You always provide excellent and effecient solutions and I just can’t thank you enough. Sincerely.
I had to make a minor change to the code because txtStart and txtEnd didn’t change no matter the selection. In case anyone needs this in the future, the change I made is below.
Original:
Me.txtStart = DateSerial(Year(Date), 3 * i – 2, 1)
Me.txtEnd = DateSerial(Year(Date), 3 * i + 1, 0)
Change:
Me.txtStart = DateSerial(Year(Date), 3 * Lo – 2, 1)
Me.txtEnd = DateSerial(Year(Date), 3 * Hi + 1, 0) -
WSRNCIENG
AskWoody LoungerYes….right as always
-
WSRNCIENG
AskWoody LoungerThanks again Hans…..
Now, can I ask yet another question, please?
Taking the scenerio I’ve outlined in this thread and on the code you’ve provided, is there an effecient way to determine the following:
Determine the FIRST Date of the first selected quarter (i) and the LAST date of the last selected quarter selected (i)? i.e. Let’s assume the user selected opt1 and opt2 (1st and 2nd quarter), txtBegin would be 1/1/CurrentYear and txtEnd would be 5/31/CurrentYear?
If the user selected opt2, opt3 and opt4 (2nd, 3rd and 4th quarter) then the txtBegin would be 4/1/CurrentYear and txtEnd would be 12/31/CurrentYear.
-
WSRNCIENG
AskWoody LoungerBEAUTIFUL…..Oh thank you Hans.
What if I wanted to include another checkbox (opt5) and title it “QTD” to pull all current quarters for the year? Would I change For i = 1 To 4 to For i = 1 To 5 and change this strIn = “Qtr In (” & Mid(strIn, 3) & “)” to strIn = “Qtr In (” & Mid(strIn, 4) & “)”?
-
WSRNCIENG
AskWoody LoungerGood Afternoon,
I have 4 option buttons, opt1, opt2, opt3, and opt4. Each option button represents the Qtr. The user may want to view a report based on a specific QTR so by selecting the qtr (option button) they want then the value needs to be passed to a query.
I’m not sure on how to build the logic to capture which option (and they can select more than 1) the user selected and I don’t know how to pass that value to the query.
I have the query built, I have the report built, I just need to pass the user’s request to the query.
For instance.
if user selects option 2 and 3, I need to pass “2 and 3” as a criteria to the query to only pull the data for 2nd and 3rd quarter.
if user selects option 4, I need to pass “4” as a criteria to the query to only pull the data for 4th quarter.Can someone please point me in the right direction.
-
WSRNCIENG
AskWoody LoungerYes it does…thank you very much.
-
WSRNCIENG
AskWoody LoungerI resolved the problem. See code.
[indent]
Long piece of code moved to attachment by HansV
[/indent]
I moved the table to another db on the server and everything went fine. Thanks Hans for your assistance, as always, it’s appreciated.
-
WSRNCIENG
AskWoody LoungerHans,
I changed the code as suggested to:
[indent]
connectionString = “ODBC;DRIVER={SQL Server}” _
+ “;SERVER=” & “KMHPSQLKY20” _
+ “;DATABASE=” + SrcDatabaseName + “;”
[/indent]
but get the same error. Oddly, I can put the table in a query, see all the fields but when I go to run the query, I get the same message.
-
WSRNCIENG
AskWoody LoungerI think I have it.
[indent]
Between DateSerial(Year(Date())-1,Month(Date())-2,1) And DateSerial(Year(Date())-1,Month(Date())-1,0)
[/indent]
If anyone knows of a more effecient way, please let me know.
-
WSRNCIENG
AskWoody LoungerThanks Hans, that’s what was missing. I knew to put the pound sign in, but was putting the last one in in the wrong place.
-
WSRNCIENG
AskWoody LoungerHans,
I believe I’ve resolved it. See below:
[indent]
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim rst As DAO.Recordset
Dim mySQL As StringmySQL = “SELECT tEmail.EmailAddy ” & _
“INTO tblTemp ” & _
“FROM tEmail ” & _
“WHERE Send=True;”DoCmd.SetWarnings False
DoCmd.RunSQL mySQL
DoCmd.SetWarnings TrueSet db = CurrentDb()
Set tdf = db.TableDefs(“tblTemp”)
Set rst = db.OpenRecordset(“tblTemp”, dbOpenTable)
[/indent]
Thanks for the assistance.
-
WSRNCIENG
AskWoody LoungerI’ve tried that several times earlier but thinking I missed something I tried your suggestion again and still I get the following error msg.
[indent]
Run-Time error 2342
a RunSQL action requires an argument consisting on an SQL statement
[/indent]
-
WSRNCIENG
AskWoody LoungerI got it Hans, as always, thanks so much for your help
-
WSRNCIENG
AskWoody LoungerOk…I’ve modified you suggestion as you said to and it provides me with the count but the count appears like it was a totals query rather than a select query. i.e.
123456789 5
987654321 3I need each record to appear with the count next to it.
123456789 1
123456789 2
123456789 3
123456789 4
123456789 5987654321 1
987654321 2
987654321 3
![]() |
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
-
No HP software folders
by
fpefpe
38 minutes ago -
Which antivirus apps and VPNs are the most secure in 2025?
by
B. Livingston
1 hour ago -
Stay connected anywhere
by
Peter Deegan
53 minutes ago -
Copilot, under the table
by
Will Fastie
2 hours, 37 minutes ago -
The Windows experience
by
Will Fastie
7 hours, 7 minutes ago -
A tale of two operating systems
by
Susan Bradley
17 minutes ago -
Microsoft : Resolving Blue Screen errors in Windows
by
Alex5723
12 hours, 27 minutes ago -
Where’s the cache today?
by
Up2you2
1 day, 3 hours ago -
Ascension says recent data breach affects over 430,000 patients
by
Nibbled To Death By Ducks
20 hours, 33 minutes ago -
Nintendo Switch 2 has a remote killing switch
by
Alex5723
58 minutes ago -
Blocking Search (on task bar) from going to web
by
HenryW
1 day, 4 hours ago -
Windows 10: Microsoft 365 Apps will be supported up to Oct. 10 2028
by
Alex5723
1 day, 21 hours ago -
Add or Remove “Ask Copilot” Context Menu in Windows 11 and 10
by
Alex5723
1 day, 21 hours ago -
regarding april update and may update
by
heybengbeng
1 day, 22 hours ago -
MS Passkey
by
pmruzicka
1 day ago -
Can’t make Opera my default browser
by
bmeacham
2 days, 6 hours ago -
*Some settings are managed by your organization
by
rlowe44
1 day, 17 hours ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
2 days, 5 hours ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
3 days ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
3 days, 9 hours ago -
AI slop
by
Susan Bradley
1 day, 3 hours ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
3 days, 11 hours ago -
Two blank icons
by
CR2
19 hours, 21 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
21 hours, 19 minutes ago -
End of 10
by
Alex5723
3 days, 22 hours ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
2 days, 20 hours ago -
test post
by
gtd12345
4 days, 4 hours ago -
Privacy and the Real ID
by
Susan Bradley
3 days, 18 hours ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
1 day, 21 hours ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
4 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.