My autoexec macro in an Access 2.0 database has 2 lines.
The first runs DoMenuItem - Database - Window - Hide.
The second lines is Runcode - Initialize(). Initialize is a procedure
in a global module that opens a form. When the form opens,
the database window is still present and visible. I thought the
first line of the macro would run to completion before the
second line started and certainly before any lines in Initialize()
were invoked. But I'm obviously wrong.
Ideas as to why? 8 4013
Should work if the database window has focus.
Try a SelectObject (any object) with the InDatabaseWindo w set to True, ahead
of the DoMenuItem.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"MLH" <CR**@NorthStat e.net> wrote in message
news:f4******** *************** *********@4ax.c om... My autoexec macro in an Access 2.0 database has 2 lines. The first runs DoMenuItem - Database - Window - Hide. The second lines is Runcode - Initialize(). Initialize is a procedure in a global module that opens a form. When the form opens, the database window is still present and visible. I thought the first line of the macro would run to completion before the second line started and certainly before any lines in Initialize() were invoked. But I'm obviously wrong.
Ideas as to why?
I was sure hoping that would work. Unfortunately, it did not
make any difference. I determined the named object was,
in fact, selected in the database window. I tried a couple
of tables and each time, the right one was selected. The
darn database window just won't close when running the
code in initialize. Dunno why?
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxx
On Thu, 29 Jan 2004 11:09:20 +0800, "Allen Browne"
<Al*********@Se eSig.Invalid> wrote: Should work if the database window has focus. Try a SelectObject (any object) with the InDatabaseWindo w set to True, ahead of the DoMenuItem.
The code in Initialize() is not exceptional in any fashion. It checks
to see if tblClient has any records, checks for a file on disk then
looks to see if a particular form exists. Then, it determines screen
resolution and opens frmInitialize. That form is not modal nor popup.
I'm beside myself on this one.
Function Initialize()
10 On Error Resume Next
20 Dim Question As String, MyMsg As String, MyUserName As String,
HorizPixels As Variant
30 CRLF = Chr$(13) & Chr$(10)
40 MyString = GetWinDir() & "\sys1(~)@. tmp"
50 If DCount("[FullName]", "tblClient" ) = 0 Then
60 If FileExists("MyS tring") = False Then
70 DoCmd SelectObject A_FORM, "frmInitialize" , True
80 If Err = 0 Then
90 FirstTime = True
100 End If
110 End If
120 End If
130 CScreenRes = GetScreenResolu tion()
131 HorizPixels = Left$(CScreenRe s, InStr(1, CScreenRes, "x") - 1)
139 If Val(HorizPixels ) < 800 Then
140 MyString = "Resolution s less than 800 x 600 unsupported. "
142 MsgBox MyString, 16, "Cannot Proceed - " & MyApp$
143 DoCmd SetWarnings True
144 DoCmd Quit
145 End If
310 If FirstTime = False Then GoTo SubsequentRuns
FirstRun:
320 DoCmd OpenForm "frmInitial ize"
330 If Err = 2102 Then
340 MyMsg = "Program has been corrupted. Contact vendor."
350 MsgBox MyMsg, 48, "Unexpected Error - " & MyApp$
360 End If
370 Exit Function
....
One more thing, rule out any anomoly you might imagine would
be associated with the unique environment the app is running
in. There are plenty of situations in which hiding the database
window works just fine on this machine. In this particular one, it
does not.
Don't have Acc2 installed any more, but you did remember that the menu items
are zero-based when counting which item it is on the menu?
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"MLH" <CR**@NorthStat e.net> wrote in message
news:eb******** *************** *********@4ax.c om... I was sure hoping that would work. Unfortunately, it did not make any difference. I determined the named object was, in fact, selected in the database window. I tried a couple of tables and each time, the right one was selected. The darn database window just won't close when running the code in initialize. Dunno why?
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxx
On Thu, 29 Jan 2004 11:09:20 +0800, "Allen Browne" <Al*********@Se eSig.Invalid> wrote:
Should work if the database window has focus. Try a SelectObject (any object) with the InDatabaseWindo w set to True,
aheadof the DoMenuItem.
Yes. And this code works fine on subsequent runs of the
program. Function Initialize() branches & runs different after
the FIRST time the program is run. On the 2nd and later
launches, the database window hides just fine. The SAME
macro command line works EVERYTIME except for the
FIRST time.
Now, to me, that's odd because the macro command to
hide the DB window is launched first. It is the programmatic
execution on the list. What could possibly matter in the code
that follows? I'm gonna try DoEvents after the DB window
hide & C if that makes a difference.
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxx
On Fri, 30 Jan 2004 09:32:15 +0800, "Allen Browne"
<Al*********@Se eSig.Invalid> wrote: Don't have Acc2 installed any more, but you did remember that the menu items are zero-based when counting which item it is on the menu?
I have tested opening a database with NOTHING but
a 1-line AutoExec macro consisting of DoMenuItem;
Database; Window; Hide. No Tables, Queries, Forms,
Reports or Modules.
That works fine.
So, this tells me that code invoked AFTER the DB
window hide line is preempting the full operation of
the DBWH operation somehow.
Well, screw me! Line #70 is the problem. I delete frmInitialize on the
first run of the app. In later runs, that form does not exist. Since
it does during the first run, line #70 causes the database window
(hidden on execute of the autoexec macro) to reappear - that's
what's happening. Big Oops! Bit Oops!
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxx
On Thu, 29 Jan 2004 18:55:58 -0500, MLH <CR**@NorthStat e.net> wrote: Function Initialize() 10 On Error Resume Next 20 Dim Question As String, MyMsg As String, MyUserName As String, HorizPixels As Variant 30 CRLF = Chr$(13) & Chr$(10) 40 MyString = GetWinDir() & "\sys1(~)@. tmp" 50 If DCount("[FullName]", "tblClient" ) = 0 Then 60 If FileExists("MyS tring") = False Then 70 DoCmd SelectObject A_FORM, "frmInitialize" , True This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mr.mcgrew |
last post by:
Out of nowhere a database I had set to hide the DB window at startup
began showing the dang window. It doesn't matter how many times I
set/unset/reset the property, it has no effect. I've tried setting the
property from code, still won't hide. I've checked via code to make
sure the property was indeed created and set in the DB properties
collection; it was, and the thing still shows. I've even created a
brand spanking new mdb file and...
|
by: mvivar |
last post by:
Hi everybody:
This will be not easy to explain as my mother language is not english,
so my apologies in advance if it sounds confusing.
We have a database access 97 wich controls time of people in their job
in order to finally know how many money costs us to run some projects.
People always estimates the time when reporting and we do have the
impression they really underestimate the time.
|
by: Michael König |
last post by:
Hello,
I'm developping a new application (btw: I'm not a real specialist but
more or less a newbie). Now I have the following problem:
Each time I leave the main form of the application Access shows the
tables collection in the database window (I don't know why). How can I
force Access to show the forms collection in the database window without
selecting it manually. I'd prefer to select the forms when the main
applicatiion form is...
|
by: MLH |
last post by:
Did A97, perchance, do away with the need for
an AutoExec macro to initiate an autoexec sequence
for databases? Or, must we still suffer with that hideous
macro?
|
by: SueB |
last post by:
Hi. I want to execute a routine, at database startup time, to relink
the backend tables. I have the code for the function, but I don't know
where to invoke it. I tried putting a call to the function in the Open
Event of the MainMenu (which gets displayed at Startup). That seems to
be too late, because I get an error that says that it can't find the
tables (I moved the backend file to a different folder, for testing of
this function).
...
| |
by: MLH |
last post by:
If I give someone a runtime app,
they can open the database
window by pressing the F-11
key. How to prevent???
|
by: Zammy |
last post by:
I have a database on a server that many people access repeatedly during
the day. I have set up the switchboard form with code to minimize the
database window, but when I try to open the database window it opens
off screen so far that I have to close the switchboard and go find the
database window, open it and reopen the switchboard form. Is there any
possibility of fixing the position of the moinimized database window
relative to the...
|
by: carmela_wong |
last post by:
How can I protect my database so that the end user needs to open it
using Shift+Enter?
Thanks
|
by: sweeneysmsm |
last post by:
Working in Access 2003, Windows XP Pro - (client not faithful to updates:(.
I have succeeded in splitting a database. (I am actually
working on a "test run copy" to insure that I am safe. My back-end contains
my tables and my front-end forms etc have "linked" icons preceding them.
Regarding the relinking code:
1. In my Access 2003 Inside-Out book it gives Startup Code to Verify and
Correct Linked Table Connections (on p. 1206)....
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |