Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / January 2005

Tip: Looking for answers? Try searching our database.

Running a function when database is opened

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Howard - 05 Jan 2005 15:18 GMT
Hi!
With lots of help from this forum, I now have code working to link to a
selected backend database. I want this function run when the frontend
database is openned. The code is a function within a module. How do I run the
function upon startup. I was opening a form in the database startup which
would run the function. The problem is that after the function is run, it
won't let me close the form using docmd acForm me.name.  What is the most
efficient way.
Signature

Thanks!
-Howard

PC Datasheet - 05 Jan 2005 15:55 GMT
You could put this code in your form's Open event:
Call NameOfFunction
Cancel = True

or,

You could use the autoexec macro to call the function. Look for autoexec
macros in the Help file.

--
                                       PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
                             resource@pcdatasheet.com
                                www.pcdatasheet.com

> Hi!
> With lots of help from this forum, I now have code working to link to a
[quoted text clipped - 7 lines]
> Thanks!
> -Howard
Howard - 05 Jan 2005 16:16 GMT
The "Cancel = True" statment didn't work. No errors, but the form is still
open. By the way, if I use the "DoCmd.Close acForm, Me.Name" statement, I get
the following error ...

"This action can't be carried out while processing a form or report event"

I don't know if this helps. Thanks!

-Howard

> You could put this code in your form's Open event:
> Call NameOfFunction
[quoted text clipped - 23 lines]
> > Thanks!
> > -Howard
PC Datasheet - 05 Jan 2005 18:59 GMT
The "Cancel = True" statment will work if coded correctly! Post all your
code in the form's open event.

Where are you using "DoCmd.Close acForm, Me.Name" ? Post all your code there
too.

Steve
PC Datasheet

> The "Cancel = True" statment didn't work. No errors, but the form is still
> open. By the way, if I use the "DoCmd.Close acForm, Me.Name" statement, I get
[quoted text clipped - 33 lines]
> > > Thanks!
> > > -Howard
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.