-
WSgrozy
AskWoody LoungerI’m getting closer on this. The word document opens now correctly (not the template) but still having problems. I’m using mail merge with the template. After populating the a merged table, access opens a new word document using the merged template. When access opens the document I still see all the field codes and can’t remove them, but when I open the document manually its correct with the proper data in place of the field codes. I’ m setting the merge up without code, perhaps that’s where my problem is. Any suggestions would be appreciated.
-
WSgrozy
AskWoody LoungerSorry HansV, in VB. I shoplifted this off one of the post. This currently opens just the template.
dim strworddoc as string
‘template
strWordDoc = “H:DBsNAVSHIPYRDSS.dot”
‘Create a Word instance
Set appWord = CreateObject(“Word.Application”)
appWord.Visible = True
‘Open the selected merge document
appWord.Documents.Open strWordDoc -
WSgrozy
AskWoody LoungerThanks again HansV.
-
WSgrozy
AskWoody LoungerHansV, can this expression be strung together allowing multiple replacements within one query of the same field. Having trouble making that work.
-
WSgrozy
AskWoody LoungerThanks much, Hans. Works perfect
-
WSgrozy
AskWoody LoungerWorks great when using the F1 Key only. When using “What’s This” i’ve prevented the access window from showing somehow, but a “msohelp.exe” is being opened hidden. No affect to users, but that application being opened prevents me from compiling the help file. I must go into task manager and end the application manually. Not so much a big deal. Tried to apply the same logic in the reference you provided but not sure “What’s This” has a macro name. I would have thought it was the equivelent of pressing F1, guess not.
-
WSgrozy
AskWoody LoungerWorks great when using the F1 Key only. When using “What’s This” i’ve prevented the access window from showing somehow, but a “msohelp.exe” is being opened hidden. No affect to users, but that application being opened prevents me from compiling the help file. I must go into task manager and end the application manually. Not so much a big deal. Tried to apply the same logic in the reference you provided but not sure “What’s This” has a macro name. I would have thought it was the equivelent of pressing F1, guess not.
-
WSgrozy
AskWoody LoungerHans, thanks works like a champ.
-
WSgrozy
AskWoody LoungerHans, thanks works like a champ.
-
WSgrozy
AskWoody LoungerI’ve narrowed it down to one specific control on a user common form that I’d like to prevent the shutdown from occuring if keypress or mousemove. Could you provide an example of an event handler which would reset the time established on my inactive form shutown(provided in earlier post). Thanks.
-
WSgrozy
AskWoody LoungerI’ve narrowed it down to one specific control on a user common form that I’d like to prevent the shutdown from occuring if keypress or mousemove. Could you provide an example of an event handler which would reset the time established on my inactive form shutown(provided in earlier post). Thanks.
-
WSgrozy
AskWoody LoungerThe database I have tracks usage and is considered sensitive. Many of my users are complacent so I setup an inactive shutdown based off of how long a control has been active. But now when users may be reading something or entering data within one control the system shuts them down. I like it to shutdown on only the active machine. I have the below associated with a specific form which is hidden when a user enters the system.
Option Compare Database
Option Explicit
Const conSeconndsPerMinute = 60
Dim sngStartTime As Single
Dim ctlSave As Control
Dim intMinutesUntilShutDown As Integer
Dim intMinutesWarningAppears As IntegerPrivate Sub Form_Close()
On Error Resume Next
ctlSave = Nothing
End SubPrivate Sub Form_Open(Cancel As Integer)
‘* Set this variable to the number of minutes of inactivity
‘* allowed before the application automatically shuts down.
intMinutesUntilShutDown = 5
‘* Set this variable to the number of minutes that the
‘* warning form will appear before the application
‘* automatically shuts down.
intMinutesWarningAppears = 1
Me.Visible = False
sngStartTime = Timer
End SubPrivate Sub Form_Timer()
‘**********************************************************************
‘* This timer event procedure will shut down the application
‘* after a specified number of minutes of inactivity. Inactivity
‘* is measured based on how long a control remains the ActiveControl.
‘**********************************************************************
Dim sngElapsedTime As Single
Dim ctlNew As Control
On Error Resume Next
Set ctlNew = Screen.ActiveControl
If Err 0 Then
‘* No activecontrol
sngElapsedTime = Timer – sngStartTime
Else
If ctlNew.Name = “InactiveShutDownCancel” Then
‘* The warning form has appeared, and the cancel button
‘* is the active control
sngElapsedTime = Timer – sngStartTime
Else
If ctlNew.Name = ctlSave.Name Then
‘* Still at same control
sngElapsedTime = Timer – sngStartTime
Else
‘* Some change has occured, we’re at a new control
Set ctlSave = ctlNew
sngStartTime = Timer
End If
If Err 0 Then
Set ctlSave = Screen.ActiveControl
End If
End If
End If
Err.Clear
Set ctlNew = Nothing
‘Debug.Print ” active control=” & ctlNew.name & ” elapsed=” & sngElapsedTime
Select Case sngElapsedTime
Case Is > (intMinutesUntilShutDown * conSeconndsPerMinute)
‘MsgBox “QUIT”
Set ctlSave = NothingCase Is > ((intMinutesUntilShutDown – intMinutesWarningAppears) * conSeconndsPerMinute)
‘* Make the warning form visible
Me.Visible = True
Case Else
‘* The next line can be commented out if the form is opened hidden
‘Me.Visible = False
End Select
Exit_Section:
End SubPrivate Sub InactiveShutDownCancel_Click()
sngStartTime = Timer
Me.Visible = False
End Sub -
WSgrozy
AskWoody LoungerThe database I have tracks usage and is considered sensitive. Many of my users are complacent so I setup an inactive shutdown based off of how long a control has been active. But now when users may be reading something or entering data within one control the system shuts them down. I like it to shutdown on only the active machine. I have the below associated with a specific form which is hidden when a user enters the system.
Option Compare Database
Option Explicit
Const conSeconndsPerMinute = 60
Dim sngStartTime As Single
Dim ctlSave As Control
Dim intMinutesUntilShutDown As Integer
Dim intMinutesWarningAppears As IntegerPrivate Sub Form_Close()
On Error Resume Next
ctlSave = Nothing
End SubPrivate Sub Form_Open(Cancel As Integer)
‘* Set this variable to the number of minutes of inactivity
‘* allowed before the application automatically shuts down.
intMinutesUntilShutDown = 5
‘* Set this variable to the number of minutes that the
‘* warning form will appear before the application
‘* automatically shuts down.
intMinutesWarningAppears = 1
Me.Visible = False
sngStartTime = Timer
End SubPrivate Sub Form_Timer()
‘**********************************************************************
‘* This timer event procedure will shut down the application
‘* after a specified number of minutes of inactivity. Inactivity
‘* is measured based on how long a control remains the ActiveControl.
‘**********************************************************************
Dim sngElapsedTime As Single
Dim ctlNew As Control
On Error Resume Next
Set ctlNew = Screen.ActiveControl
If Err 0 Then
‘* No activecontrol
sngElapsedTime = Timer – sngStartTime
Else
If ctlNew.Name = “InactiveShutDownCancel” Then
‘* The warning form has appeared, and the cancel button
‘* is the active control
sngElapsedTime = Timer – sngStartTime
Else
If ctlNew.Name = ctlSave.Name Then
‘* Still at same control
sngElapsedTime = Timer – sngStartTime
Else
‘* Some change has occured, we’re at a new control
Set ctlSave = ctlNew
sngStartTime = Timer
End If
If Err 0 Then
Set ctlSave = Screen.ActiveControl
End If
End If
End If
Err.Clear
Set ctlNew = Nothing
‘Debug.Print ” active control=” & ctlNew.name & ” elapsed=” & sngElapsedTime
Select Case sngElapsedTime
Case Is > (intMinutesUntilShutDown * conSeconndsPerMinute)
‘MsgBox “QUIT”
Set ctlSave = NothingCase Is > ((intMinutesUntilShutDown – intMinutesWarningAppears) * conSeconndsPerMinute)
‘* Make the warning form visible
Me.Visible = True
Case Else
‘* The next line can be commented out if the form is opened hidden
‘Me.Visible = False
End Select
Exit_Section:
End SubPrivate Sub InactiveShutDownCancel_Click()
sngStartTime = Timer
Me.Visible = False
End Sub -
WSgrozy
AskWoody Loungermuch thanks
-
WSgrozy
AskWoody Loungermuch thanks
![]() |
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
-
Windows 11 Windows Updater question
by
Tex265
6 hours, 1 minute ago -
Key, Key, my kingdom for a Key!
by
RetiredGeek
12 hours, 56 minutes ago -
Registry Patches for Windows 10
by
Drcard:))
17 hours, 27 minutes ago -
Cannot get line length to NOT wrap in Outlining in Word 365
by
CWBillow
1 minute ago -
DDU (Display Driver Uninstaller) updates
by
Alex5723
10 hours, 49 minutes ago -
Align objects on a OneNote page
by
CWBillow
22 hours, 54 minutes ago -
OneNote Send To button?
by
CWBillow
23 hours, 38 minutes ago -
WU help needed with “Some settings are managed by your organization”
by
Peobody
1 day, 8 hours ago -
No Newsletters since 27 January
by
rog7
1 day, 4 hours ago -
Linux Mint Debian Edition 7 gets OEM support, death of Ubuntu-based Mint ?
by
Alex5723
8 hours, 44 minutes ago -
Windows Update “Areca Technology Corporation – System – 6.20.0.41”
by
Bruce
7 hours, 24 minutes ago -
Google One Storage Questions
by
LHiggins
8 hours, 46 minutes ago -
Button Missing for Automatic Apps Updates
by
pmcjr6142
8 hours, 5 minutes ago -
Ancient SSD thinks it’s new
by
WSila
13 hours, 20 minutes ago -
Washington State lab testing provider exposed health data of 1.6 million people
by
Nibbled To Death By Ducks
1 day, 23 hours ago -
WinRE KB5057589 fake out
by
Susan Bradley
1 day, 16 hours ago -
The April 2025 Windows RE update might show as unsuccessful in Windows Update
by
Susan Bradley
1 day, 6 hours ago -
Firefox 137
by
Charlie
9 hours, 44 minutes ago -
Whisky, a popular Wine frontend for Mac gamers, is no more
by
Alex5723
2 days, 11 hours ago -
Windows 11 Insider Preview build 26120.3863 (24H2) released to BETA
by
joep517
2 days, 11 hours ago -
Windows 11 Insider Preview build 26200.5551 released to DEV
by
joep517
2 days, 11 hours ago -
New Windows 11 PC setup — can I start over in the middle to set up a local id?
by
ctRanger
1 day, 7 hours ago -
Windows 11 Insider Preview Build 26100.3902 (24H2) released to Release Preview
by
joep517
2 days, 15 hours ago -
Oracle kinda-sorta tells customers it was pwned
by
Nibbled To Death By Ducks
2 days, 21 hours ago -
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
3 days, 7 hours ago -
Office apps read-only for family members
by
b
3 days, 10 hours ago -
Defunct domain for Microsoft account
by
CWBillow
3 days, 6 hours ago -
24H2??
by
CWBillow
1 day, 7 hours ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
1 day, 3 hours ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
1 day, 7 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.