-
WSStewart
AskWoody LoungerThe problem with opening recordsets on parameter queries is that you have to explicitly specify the parameter values for the query and then execute it.
I’d be tempted to change your code to something like
Private Sub Report_Open(Cancel As Integer)
Dim intColCount As Integer
Dim intControlCount As Integer
Dim i As Integer
Dim strName As StringDim myStr as string
On Error Resume Next
Dim rst As DAO.Recordset
Dim db As DAO.Databasemystr = “TRANSFORM Count(tblVolunteerSchedule.VolDate) AS CountOfVolDate”
mystr = mystr & “SELECT tblVolunteers.LastName, tblVolunteers.FirstName”
mystr = mystr & “FROM tblVolunteers LEFT JOIN tblVolunteerSchedule ON tblVolunteers.VolunteerID = tblVolunteerSchedule.VolunteerID”
mystr = mystr & “WHERE (((tblVolunteerSchedule.VolDate) Between #”
mystr = mystr & format([Start Date],”mm/dd/yyyy”) & “# And #” & format([End Date],”mm/dd/yyyy”) & “#))”
mystr = mystr & “GROUP BY tblVolunteers.LastName, tblVolunteers.FirstName”
mystr = mystr & “PIVOT tblVolunteerSchedule.VolDate;”Set db = CurrentDb
Set rst = db.OpenRecordset(mystr)This will generate the query for you. You will have to replace the [StartDate] and [EndDate] with valid fields or values.
otherwise have a look in the help for using the querydef object
eg
Set rst = query1.openrecordset
-
WSStewart
AskWoody LoungerAndrew,
It’s the second thing I did. Interestingly enough turning the macros back on didn’t work for me under XP.
I can only assume that this relates to the effected security level.
the appWord.WordBasic.DisableAutoMacros 1
set the Macro Security Level to high.
The appWord.WordBasic.DisableAutoMacros 0
had no effect. Obviously we are not meant to be able to reduce security levels via code, again to prevent macro viruses I can understand this.I can also live with manually resetting the Macro security level after I have completed processing.
Again, thanks for the help.
regards
Stewart
Don’t forget to turn the automacros back on at the end of your macro by using the second line. This will avoid dramas next time you DO want the automacros to fire.
-
WSStewart
AskWoody LoungerAndrew,
It’s the second thing I did. Interestingly enough turning the macros back on didn’t work for me under XP.
I can only assume that this relates to the effected security level.
the appWord.WordBasic.DisableAutoMacros 1
set the Macro Security Level to high.
The appWord.WordBasic.DisableAutoMacros 0
had no effect. Obviously we are not meant to be able to reduce security levels via code, again to prevent macro viruses I can understand this.I can also live with manually resetting the Macro security level after I have completed processing.
Again, thanks for the help.
regards
Stewart
Don’t forget to turn the automacros back on at the end of your macro by using the second line. This will avoid dramas next time you DO want the automacros to fire.
-
WSStewart
AskWoody LoungerI appreciate you taking the time to reply.
I tried the alt-D approach with no success (after your suggestion) and was trying very hard to figure out what my next step was.
The trainable dialog closer isn’t any good to me as I do not know what dialog will appear, or even if one will.
Andrew Lockton somehow managed to dig up a solution from an obscure part of the lounge so I’m ok now.
Thanks.
Stewart
-
WSStewart
AskWoody LoungerI appreciate you taking the time to reply.
I tried the alt-D approach with no success (after your suggestion) and was trying very hard to figure out what my next step was.
The trainable dialog closer isn’t any good to me as I do not know what dialog will appear, or even if one will.
Andrew Lockton somehow managed to dig up a solution from an obscure part of the lounge so I’m ok now.
Thanks.
Stewart
-
WSStewart
AskWoody LoungerAndrew,
how on earth did you find that. Yet another bit of Hans magic, delivered by Andrew magic.
I had searched through the lounge but I would have never found that by myself in a million years.
using the code
Set appWord = CreateObject(“Word.Application”)
appWord.WordBasic.DisableAutoMacros 1solved my problem perfectly.
once again Thank You.
-
WSStewart
AskWoody LoungerAndrew,
how on earth did you find that. Yet another bit of Hans magic, delivered by Andrew magic.
I had searched through the lounge but I would have never found that by myself in a million years.
using the code
Set appWord = CreateObject(“Word.Application”)
appWord.WordBasic.DisableAutoMacros 1solved my problem perfectly.
once again Thank You.
-
WSStewart
AskWoody Loungeryou could always build the path in the after update event of the field and assign it to another field on the form for the user to click on.
assuming your surname field is called txtSurname
create a new edit control called txtxSurnameLink and set the is hyperlink property to true.
in the after updae event for txtSurnamedo some thing like this
Me.txtSurnameLink = “pathsurname” & Me.txtSurname & “.htm”in your report you could do the same thing for display.
As far as I know you can’t use a hyperlink in a report except for dipsplay as there is no way of retrieving the click on the link from a report canvas.
-
WSStewart
AskWoody Loungeryou could always build the path in the after update event of the field and assign it to another field on the form for the user to click on.
assuming your surname field is called txtSurname
create a new edit control called txtxSurnameLink and set the is hyperlink property to true.
in the after updae event for txtSurnamedo some thing like this
Me.txtSurnameLink = “pathsurname” & Me.txtSurname & “.htm”in your report you could do the same thing for display.
As far as I know you can’t use a hyperlink in a report except for dipsplay as there is no way of retrieving the click on the link from a report canvas.
-
WSStewart
AskWoody LoungerCharlotte,
if my comment offended you in any way, you have my sincere appologies. It was a post made out of admiration and amusement.
Stewart
-
WSStewart
AskWoody LoungerCharlotte,
if my comment offended you in any way, you have my sincere appologies. It was a post made out of admiration and amusement.
Stewart
-
WSStewart
AskWoody LoungerMate,
I wasn’t having a go at her, I was admiring her style. She has helped me also.
Stewart
-
WSStewart
AskWoody LoungerMate,
I wasn’t having a go at her, I was admiring her style. She has helped me also.
Stewart
-
WSStewart
AskWoody LoungerHans,
I’ve used
With appAccess Debug.Print .IsCompiled .RunCommand acCmdCompileAndSaveAllModules Debug.Print .IsCompiled End With
and was surprised that the RunCommand method is applicable to the application object. I checked the help and there it was, looks like I need to have a better look at the object model.
Just as an aside, I got curious at thsi point and started looking for the differences between a DoCMD.RunCommand and an Application.RunCommand. The help provided the following…
“To run the RunCommand action in Visual Basic, use the RunCommand method of the Application object. (This is equivalent to the RunCommand method of the DoCmd object.)”It was interesting that when I tested with a module that contained a syntax error it didn’t generate an error, it just left the database in an uncompiled state, not that it matters as I can just flag for manual investigation if the IsCompiled property remains false.
Thanks for the tip.
Cheers
Stewart
-
WSStewart
AskWoody LoungerHans,
I’ve used
With appAccess Debug.Print .IsCompiled .RunCommand acCmdCompileAndSaveAllModules Debug.Print .IsCompiled End With
and was surprised that the RunCommand method is applicable to the application object. I checked the help and there it was, looks like I need to have a better look at the object model.
Just as an aside, I got curious at thsi point and started looking for the differences between a DoCMD.RunCommand and an Application.RunCommand. The help provided the following…
“To run the RunCommand action in Visual Basic, use the RunCommand method of the Application object. (This is equivalent to the RunCommand method of the DoCmd object.)”It was interesting that when I tested with a module that contained a syntax error it didn’t generate an error, it just left the database in an uncompiled state, not that it matters as I can just flag for manual investigation if the IsCompiled property remains false.
Thanks for the tip.
Cheers
Stewart
![]() |
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
-
Firefox 137
by
Charlie
32 minutes ago -
Whisky, a popular Wine frontend for Mac gamers, is no more
by
Alex5723
2 hours, 32 minutes ago -
Windows 11 Insider Preview build 26120.3863 (24H2) released to BETA
by
joep517
2 hours, 44 minutes ago -
Windows 11 Insider Preview build 26200.5551 released to DEV
by
joep517
2 hours, 46 minutes ago -
New Windows 11 PC setup — can I start over in the middle to set up a local id?
by
ctRanger
2 hours, 51 minutes ago -
Windows 11 Insider Preview Build 26100.3902 (24H2) released to Release Preview
by
joep517
6 hours, 18 minutes ago -
Oracle kinda-sorta tells customers it was pwned
by
Nibbled To Death By Ducks
12 hours, 19 minutes ago -
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
22 hours, 39 minutes ago -
Office apps read-only for family members
by
b
1 day, 1 hour ago -
Defunct domain for Microsoft account
by
CWBillow
22 hours, 7 minutes ago -
24H2??
by
CWBillow
12 hours, 19 minutes ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
6 hours, 33 minutes ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
6 hours, 47 minutes ago -
TotalAV safety warning popup
by
Theodore Nicholson
3 hours, 8 minutes ago -
two pages side by side land scape
by
marc
2 days, 23 hours ago -
Deleting obsolete OneNote notebooks
by
afillat
3 days, 1 hour ago -
Word/Outlook 2024 vs Dragon Professional 16
by
Kathy Stevens
2 days, 4 hours ago -
Security Essentials or Defender?
by
MalcolmP
2 days, 6 hours ago -
April 2025 updates out
by
Susan Bradley
1 hour, 49 minutes ago -
Framework to stop selling some PCs in the US due to new tariffs
by
Alex5723
2 days ago -
WARNING about Nvidia driver version 572.83 and 4000/5000 series cards
by
Bob99
1 day, 14 hours ago -
Creating an Index in Word 365
by
CWBillow
2 days, 16 hours ago -
Coming at Word 365 and Table of Contents
by
CWBillow
1 day, 4 hours ago -
Windows 11 Insider Preview Build 22635.5170 (23H2) released to BETA
by
joep517
3 days, 20 hours ago -
Has the Microsoft Account Sharing Problem Been Fixed?
by
jknauth
3 days, 23 hours ago -
W11 24H2 – Susan Bradley
by
G Pickerell
4 days, 1 hour ago -
7 tips to get the most out of Windows 11
by
Alex5723
3 days, 23 hours ago -
Using Office apps with non-Microsoft cloud services
by
Peter Deegan
1 hour, 12 minutes ago -
I installed Windows 11 24H2
by
Will Fastie
1 day, 23 hours ago -
NotifyIcons — Put that System tray to work!
by
Deanna McElveen
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.