I have attached a database that I downloaded from this website; it has a main form that displays two subforms; I’m trying to print a report from the Product SubForm; I want the Report to only display the Products that are chosen from the Category SubForm. I get a Data type mismatch criteria expression; but not sure why this is happening.
![]() |
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 |
-
Printing Reports (Access 2003)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Printing Reports (Access 2003)
- This topic has 5 replies, 2 voices, and was last updated 18 years, 8 months ago.
Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody LoungerSeptember 6, 2006 at 8:39 pm #1027478 -
WSMigAnt
AskWoody LoungerSeptember 7, 2006 at 2:18 pm #1027583Thanks; for the code and for the information between number fields and test fields. I have a new problem; I placed some labels on the subform called sbfProducts; I made the labels sort the Product ID and Product Name in ascending or descending order based on clicking on the labels. If I click on the Product Name label and sort the data by ascending order the form sorts the data; however when I click on the Preview Report command button the report displays the data that is displayed in the form; but not in the order that is displayed in the form. I have attached the database.
-
WSHansV
AskWoody Lounger -
WSMigAnt
AskWoody LoungerSeptember 7, 2006 at 4:45 pm #1027616If you look at the Main Form I have included a Text Box that displays the current value of the SubForm’s sbfProducts Order By value. When you open the attached database you will see that the SubForm’s sbfProducts Order By value = strProductName DESC. When you click on the Report Preview Button the report Order By value is blank; look at the footer of the report or open the report in design view and you will notice that the Order By value does not = strProductName DESC. What I’m I missing here; why doesn’t the report use the value from the form?
-
WSHansV
AskWoody LoungerSeptember 7, 2006 at 5:39 pm #1027626Subforms are not part of the Forms collection. If you want to refer to a subform, you must do it like this:
Forms!MainForm!SubForm
where SubForm is the name of the subform as a control on the main form. And if you want to refer to a property of the subform as a form as opposed to the subform as a control on the mainform, you must do it like this:
Forms!MainForm!SubForm.Form.OrderBy
For the same reason, you can’t use IsLoaded(“sbfProducts”). Test for IsLoaded(“frmMain”) instead. So the code becomes
Private Sub Report_Open(Cancel As Integer)
If IsFormLoaded("frmMain") = False Then
Exit Sub
End IfIf Forms!frmMain!sbfProducts.Form.FilterOn = True Then
Me.Filter = Forms!frmMain!sbfProducts.Form.Filter
Me.FilterOn = True
End IfIf Forms!frmMain!sbfProducts.Form.OrderByOn = True Then
Me.OrderBy = Forms!frmMain!sbfProducts.Form.OrderBy
Me.OrderByOn = True
End If
End Sub
(I removed the part referring to a non-existent variable stDocName)
-
-
-
Viewing 1 reply thread -

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
-
Network Issue
by
Casey H
1 hour, 9 minutes ago -
Fedora Linux is now an official WSL distro
by
Alex5723
4 hours, 19 minutes ago -
May 2025 Office non-Security updates
by
PKCano
4 hours, 46 minutes ago -
Windows 10 filehistory including onedrive folder
by
Steve Bondy
6 hours, 41 minutes ago -
pages print on restart (Win 11 23H2)
by
cyraxote
5 hours, 57 minutes ago -
Windows 11 Insider Preview build 26200.5581 released to DEV
by
joep517
8 hours, 53 minutes ago -
Windows 11 Insider Preview build 26120.3950 (24H2) released to BETA
by
joep517
8 hours, 54 minutes ago -
Proton to drop prices after ruling against “Apple tax”
by
Cybertooth
16 hours, 15 minutes ago -
24H2 Installer – don’t see Option for non destructive install
by
JP
38 minutes ago -
Asking Again here (New User and Fast change only backups)
by
thymej
1 day, 3 hours ago -
How much I spent on the Mac mini
by
Will Fastie
3 hours, 1 minute ago -
How to get rid of Copilot in Microsoft 365
by
Lance Whitney
4 hours, 47 minutes ago -
Spring cleanup — 2025
by
Deanna McElveen
1 day, 9 hours ago -
Setting up Windows 11
by
Susan Bradley
4 hours, 32 minutes ago -
VLC Introduces Cutting-Edge AI Subtitling and Translation Capabilities
by
Alex5723
1 day, 4 hours ago -
Powershell version?
by
CWBillow
1 day, 5 hours ago -
SendTom Toys
by
CWBillow
2 hours, 22 minutes ago -
Add shortcut to taskbar?
by
CWBillow
1 day, 9 hours ago -
Sycophancy in GPT-4o: What happened
by
Alex5723
2 days, 2 hours ago -
How can I install Skype on Windows 7?
by
Help
2 days ago -
Logitech MK850 Keyboard issues
by
Rush2112
1 day, 7 hours ago -
We live in a simulation
by
Alex5723
2 days, 16 hours ago -
Netplwiz not working
by
RetiredGeek
2 days, 2 hours ago -
Windows 11 24H2 is broadly available
by
Alex5723
3 days, 4 hours ago -
Microsoft is killing Authenticator
by
Alex5723
6 hours, 32 minutes ago -
Downloads folder location
by
CWBillow
3 days, 11 hours ago -
Remove a User from Login screen
by
CWBillow
2 days, 6 hours ago -
TikTok fined €530 million for sending European user data to China
by
Nibbled To Death By Ducks
3 days, 2 hours ago -
Microsoft Speech Recognition Service Error Code 1002
by
stanhutchings
3 days, 2 hours ago -
Is it a bug or is it expected?
by
Susan Bradley
1 day, 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.