^{F4} - what does this do (1 Viewer)

prasadgov

New member
Local time
Today, 09:36
Joined
Oct 12, 2021
Messages
23
Hi,

I inherited a Access database, which runs data downloaded from Wufoo forms.
I then run a .vbs script, which saves the excel into a path and then opens the database to import excel data and then run queries.

The database part of the code in the .vbs script is as below.

Code:
[CODE]...................

Dim db ''As DAO.Database 
        Dim ac ''As Access Application 
        Set ac = CreateObject("Access.Application")
        ac.OpenCurrentDatabase("C:\access\perf_data_fe.accdb") 
        set shl = createobject("wscript.shell")
        shl.sendkeys "^{F4}"
        set db = ac.CurrentDB
        ac.docmd.openform "frmDone"
        'ac.docmd.closeform "frmDone"
        'appAccess.DoCmd.Close 3, cstrReport ' acReport = 3
'appAccess.Quit
'Set appAccess = Nothing
.........
[/CODE]

I checked the database and there is only a macro for pause and nothing else.
How to check which queries are being executed.

TIA
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:36
Joined
Oct 29, 2018
Messages
21,537
Is the macro called Autokeys?
 

GPGeorge

George Hepworth
Local time
Today, 06:36
Joined
Nov 25, 2004
Messages
1,987
Hi,

I inherited a Access database, which runs data downloaded from Wufoo forms.
I then run a .vbs script, which saves the excel into a path and then opens the database to import excel data and then run queries.

The database part of the code in the .vbs script is as below.

Code:
[CODE]...................

Dim db ''As DAO.Database
        Dim ac ''As Access Application
        Set ac = CreateObject("Access.Application")
        ac.OpenCurrentDatabase("C:\access\perf_data_fe.accdb")
        set shl = createobject("wscript.shell")
        shl.sendkeys "^{F4}"
        set db = ac.CurrentDB
        ac.docmd.openform "frmDone"
        'ac.docmd.closeform "frmDone"
        'appAccess.DoCmd.Close 3, cstrReport ' acReport = 3
'appAccess.Quit
'Set appAccess = Nothing
.........
[/CODE]

I checked the database and there is only a macro for pause and nothing else.
How to check which queries are being executed.

TIA
shl.sendkeys "^{F4}" mimics the action of pressing the ctrl and F4 keys simultaneously. It closes an open Window. The risk of using SendKeys is that it doesn't necessarily impact the object you expect or want it to. It's probably wiser to find and alternative way that does identify the proper Window to be closed.

In this code, there seems to be code that opens frmDone in an external accdb called "perf_data_fe.accdb" and immediately closes the form and then that accdb again. Perhaps the code you are looking for runs in the Open or Load event of frmDone in the external accdb, although it might be an AutoExec macro in that accdb.
 

prasadgov

New member
Local time
Today, 09:36
Joined
Oct 12, 2021
Messages
23
shl.sendkeys "^{F4}" mimics the action of pressing the ctrl and F4 keys simultaneously. It closes an open Window. The risk of using SendKeys is that it doesn't necessarily impact the object you expect or want it to. It's probably wiser to find and alternative way that does identify the proper Window to be closed.

In this code, there seems to be code that opens frmDone in an external accdb called "perf_data_fe.accdb" and immediately closes the form and then that accdb again. Perhaps the code you are looking for runs in the Open or Load event of frmDone in the external accdb, although it might be an AutoExec macro in that accdb.
correct, it was the code behind frmDone! it opens the db, runs the code on the form load event and then closes the form and the db.
Thanks!
 

Isaac

Lifelong Learner
Local time
Today, 06:36
Joined
Mar 14, 2017
Messages
8,871
Yeah, using SendKeys, while kinda fun like tossing darts from a great distance at a dartboard after a few drinks, may be a little bit amusing on a good day and that's about it.
 

Users who are viewing this thread

Top Bottom