-
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
-
Microsoft : Edge is better than Chrome
by
Alex5723
10 minutes ago -
The EU launched DNS4EU
by
Alex5723
12 hours, 52 minutes ago -
Cell Phone vs. Traditional Touchtone Phone over POTS
by
280park
3 hours, 13 minutes ago -
Lost access to all my networked drives (shares) listed in My Computer
by
lwerman
18 hours, 18 minutes ago -
Set default size for pasted photo to word
by
Cyn
1 day ago -
Dedoimedo tries 24H2…
by
Cybertooth
12 hours, 26 minutes ago -
Windows 11 Insider Preview build 27871 released to Canary
by
joep517
1 day, 23 hours ago -
Windows 11 ad from Campaign Manager in Windows 10
by
Jim McKenna
1 day, 20 hours ago -
Small desktops
by
Susan Bradley
13 hours, 59 minutes ago -
Totally disable Bitlocker
by
CWBillow
16 hours, 52 minutes ago -
Phishers extract Millions from HMRC accounts..
by
Microfix
1 day, 20 hours ago -
Windows 10 22H2 Update today (5 June) says up-to-date but last was 2025-04
by
Alan_uk
3 days, 3 hours ago -
Thoughts on Malwarebytes Scam Guard for Mobile?
by
opti1
22 hours, 1 minute ago -
Mystical Desktop
by
CWBillow
3 days, 6 hours ago -
Meta and Yandex secretly tracked billions of Android users
by
Alex5723
2 days, 11 hours ago -
MS-DEFCON 2: Do you need that update?
by
Susan Bradley
1 day, 3 hours ago -
CD/DVD drive is no longer recognized
by
WSCape Sand
3 days, 21 hours ago -
Windows 11 24H2 Default Apps stuck on Edge and Adobe Photoshop
by
MikeBravo
4 days ago -
North Face and Cartier customer data stolen in cyber attacks
by
Alex5723
3 days, 22 hours ago -
What is wrong with simple approach?
by
WSSpoke36
1 day, 20 hours ago -
Microsoft-Backed Builder.ai Set for Bankruptcy After Cash Seized
by
Alex5723
4 days, 10 hours ago -
Location, location, location
by
Susan Bradley
3 days ago -
Cannot get a task to run a restore point
by
CWBillow
4 days, 11 hours ago -
Frustrating search behavior with Outlook
by
MrJimPhelps
4 days, 2 hours ago -
June 2025 Office non-Security Updates
by
PKCano
4 days, 22 hours ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
41 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
4 days, 22 hours ago -
How start headers and page numbers on page 3?
by
Davidhs
5 days, 8 hours ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
4 days, 11 hours ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
5 days, 17 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.