-
WSDrew
AskWoody LoungerEvery so often I get snagged by this one myself. ADO doesn’t use the asterisk (*) for a wildcard. ADO uses the percent symbol %. So replace the * with a percent symbol, and you should be good to go.
Odd, isn’t it? You can paste the SQL directly into a query, and it works, but ADO does not see the * as a wildcard.
Hope this helps!
-
WSDrew
AskWoody LoungerEvery so often I get snagged by this one myself. ADO doesn’t use the asterisk (*) for a wildcard. ADO uses the percent symbol %. So replace the * with a percent symbol, and you should be good to go.
Odd, isn’t it? You can paste the SQL directly into a query, and it works, but ADO does not see the * as a wildcard.
Hope this helps!
-
WSDrew
AskWoody LoungerOh, I had always thought it was SQL Server, because Jet doesn’t mind getting an actual date variable. So Jet just ‘comprimises’ I guess. Learn something knew everyday.
-
WSDrew
AskWoody LoungerOh, I had always thought it was SQL Server, because Jet doesn’t mind getting an actual date variable. So Jet just ‘comprimises’ I guess. Learn something knew everyday.
-
WSDrew
AskWoody LoungerNot a waste of time. Sometimes we all need a second pair of eyes on something, that’s why the lounge is here!
As for the date formatting, if you stick with Access, you can’t go wrong with #” & dteSomDateVariable & “# because the date variable is a constant format (double variable, whole numbers for days, decimal for time), which is Universal in Access. If you want it to work in SQL server, then I believe SQL Server wants MM/DD/YYYY.
-
WSDrew
AskWoody LoungerNot a waste of time. Sometimes we all need a second pair of eyes on something, that’s why the lounge is here!
As for the date formatting, if you stick with Access, you can’t go wrong with #” & dteSomDateVariable & “# because the date variable is a constant format (double variable, whole numbers for days, decimal for time), which is Universal in Access. If you want it to work in SQL server, then I believe SQL Server wants MM/DD/YYYY.
-
WSDrew
AskWoody LoungerAha. adCmdTableDirect has always worked for me for naming a table in the Open method. Honestly don’t think I tried adCmdTable. Quite frankly, for the past year or two, I simply leave the default, because I’m using SQL statements, and if I am just adding a record, I don’t even use a recordset, I just use INSERT INTO statements….though, if I had a ‘massive’ data dump, I would go back to recordsets.
Either way, it’ll be interesting to find out if the Options argument is the cause of the actual problem.
-
WSDrew
AskWoody LoungerAha. adCmdTableDirect has always worked for me for naming a table in the Open method. Honestly don’t think I tried adCmdTable. Quite frankly, for the past year or two, I simply leave the default, because I’m using SQL statements, and if I am just adding a record, I don’t even use a recordset, I just use INSERT INTO statements….though, if I had a ‘massive’ data dump, I would go back to recordsets.
Either way, it’ll be interesting to find out if the Options argument is the cause of the actual problem.
-
WSDrew
AskWoody LoungerThat’s what I thought, I always leave it blank, which defaults to -1, which I am not sure what that is. But I always thought adCmdTable, and adCmdTableDirect was used when you refer to a table, and not to a SQL string. When I saw this post, I checked the help file, and quite frankly felt more confused about the issue. I have opened tables directly with ADO (if I am just adding a record), and put “tblSomething” where a SQL statement would go, and I have problems if I don’t use adCmdTableDirect (though I don’t think I tried adCmdTable).
-
WSDrew
AskWoody LoungerThat’s what I thought, I always leave it blank, which defaults to -1, which I am not sure what that is. But I always thought adCmdTable, and adCmdTableDirect was used when you refer to a table, and not to a SQL string. When I saw this post, I checked the help file, and quite frankly felt more confused about the issue. I have opened tables directly with ADO (if I am just adding a record), and put “tblSomething” where a SQL statement would go, and I have problems if I don’t use adCmdTableDirect (though I don’t think I tried adCmdTable).
-
WSDrew
AskWoody LoungerHmm, you’re right, I guess I deal with Callback functions too much, because with a callback function, it DOES size the slider based on the number of items. Try populating the combo with a callback function.
-
WSDrew
AskWoody LoungerHmm, you’re right, I guess I deal with Callback functions too much, because with a callback function, it DOES size the slider based on the number of items. Try populating the combo with a callback function.
-
WSDrew
AskWoody LoungerThat’s not entirely true. A combobox has to get the initial ‘count’ when it loads, so when the list is dropped down, the data my not be ‘all there’, but the slider will be the appropriate size. You may want to look into using a callback function, if you suspect you are ‘losing’ the connection somehow.
-
WSDrew
AskWoody LoungerThat’s not entirely true. A combobox has to get the initial ‘count’ when it loads, so when the list is dropped down, the data my not be ‘all there’, but the slider will be the appropriate size. You may want to look into using a callback function, if you suspect you are ‘losing’ the connection somehow.
-
WSDrew
AskWoody LoungerHere’s the SQL for a single query solution:
SELECT ProdID, yearno, weekno, T1.sold, (SELECT TOP 1 itemsperbox FROM itemsize WHERE (itemsize.yearno=T1.yearno AND itemsize.weekno<=T1.weekno) OR itemsize.yearno<T1.yearno ORDER BY yearno DESC, weekno DESC) AS ItemsPerBox, (SELECT TOP 1 itemsperbox*T1.sold AS total FROM itemsize WHERE (itemsize.yearno=T1.yearno AND itemsize.weekno<=T1.weekno) OR itemsize.yearno<T1.yearno ORDER BY yearno DESC, weekno DESC) AS total
FROM sold AS T1
ORDER BY ProdID, yearno, weekno;I used itemsize and sold as the table names, per your post, but I would recommend changing them to tblItemSize and tblSold. (the sold table has a sold field…which can lead to some confusion.
Note, the query results will have 'nulls' instead of zeros, if there is no itemsperbox value 'yet'. If you must have zeros, then use this (it will just take longer…)
SELECT ProdID, yearno, weekno, T1.sold, IIF(IsNull((SELECT TOP 1 itemsperbox FROM itemsize WHERE (itemsize.yearno=T1.yearno AND itemsize.weekno<=T1.weekno) OR itemsize.yearno<T1.yearno ORDER BY yearno DESC, weekno DESC)),0,(SELECT TOP 1 itemsperbox FROM itemsize WHERE (itemsize.yearno=T1.yearno AND itemsize.weekno<=T1.weekno) OR itemsize.yearno<T1.yearno ORDER BY yearno DESC, weekno DESC)) AS ItemsPerBox, IIF(IsNull((SELECT TOP 1 itemsperbox*T1.sold AS total FROM itemsize WHERE (itemsize.yearno=T1.yearno AND itemsize.weekno<=T1.weekno) OR itemsize.yearno<T1.yearno ORDER BY yearno DESC, weekno DESC)),0,(SELECT TOP 1 itemsperbox*T1.sold AS total FROM itemsize WHERE (itemsize.yearno=T1.yearno AND itemsize.weekno<=T1.weekno) OR itemsize.yearno<T1.yearno ORDER BY yearno DESC, weekno DESC)) AS total
FROM sold AS T1
ORDER BY ProdID, yearno, weekno;You can get zero's with the first query (which would be faster, by putting records in the itemsize table like a,1,1,0, but that may disrupt other systems in your database)
Have fun….
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
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
-
Word crashes when accessing Help
by
CWBillow
1 hour, 51 minutes ago -
New Microsoft Nag — Danger! Danger! sign-in to your Microsoft Account
by
EricB
5 hours, 38 minutes ago -
Blank Inetpub folder
by
Susan Bradley
6 hours, 29 minutes ago -
Google : Extended Repair Program for Pixel 7a
by
Alex5723
8 hours, 21 minutes ago -
Updates seem to have broken Microsoft Edge
by
rebop2020
12 hours, 5 minutes ago -
Wait command?
by
CWBillow
1 hour, 37 minutes ago -
Malwarebytes 5 Free version manual platform updates
by
Bob99
15 hours ago -
inetpub : Microsoft’s patch for CVE-2025–21204 introduces vulnerability
by
Alex5723
21 hours, 36 minutes ago -
Windows 10 finally gets fix
by
Susan Bradley
1 day, 6 hours ago -
AMD Ryzen™ Chipset Driver Release Notes 7.04.09.545
by
Alex5723
1 day, 7 hours ago -
Win 7 MS Essentials suddenly not showing number of items scanned.
by
Oldtimer
1 day, 2 hours ago -
France : A law requiring messaging apps to implement a backdoor ..
by
Alex5723
1 day, 20 hours ago -
Dev runs Windows 11 ARM on an iPad Air M2
by
Alex5723
1 day, 21 hours ago -
MS-DEFCON 3: Cleanup time
by
Susan Bradley
16 hours, 42 minutes ago -
KB5056686 (.NET v8.0.15) Delivered Twice in April 2025
by
lmacri
2 hours, 59 minutes ago -
How to enable Extended Security Maintenance on Ubuntu 20.04 LTS before it dies
by
Alex5723
2 days, 8 hours ago -
Windows 11 Insider Preview build 26200.5562 released to DEV
by
joep517
2 days, 12 hours ago -
Windows 11 Insider Preview build 26120.3872 (24H2) released to BETA
by
joep517
2 days, 12 hours ago -
Unable to eject external hard drives
by
Robertos42
23 hours, 26 minutes ago -
Saying goodbye to not-so-great technology
by
Susan Bradley
11 hours, 7 minutes ago -
Tech I don’t miss, and some I do
by
Will Fastie
9 hours, 1 minute ago -
Synology limits hard drives
by
Susan Bradley
3 days, 17 hours ago -
Links from Microsoft 365 and from WhatsApp not working
by
rog7
2 days, 19 hours ago -
WhatsApp Security Advisories CVE-2025-30401
by
Alex5723
3 days, 23 hours ago -
Upgrade Sequence
by
doneager
3 days, 16 hours ago -
Chrome extensions with 6 million installs have hidden tracking code
by
Nibbled To Death By Ducks
1 day, 22 hours ago -
Uninstall “New Outlook” before installing 2024 Home & Business?
by
Tex265
2 days, 15 hours ago -
The incredible shrinking desktop icons
by
Thumper
4 days, 20 hours ago -
Windows 11 Insider Preview Build 22635.5240 (23H2) released to BETA
by
joep517
4 days, 21 hours ago -
Connecting hard drive on USB 3.2 freezes File Explorer & Disk Management
by
WSJMGatehouse
1 day, 20 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.