Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2013, 09:14 PM
Registered User
 
Join Date: Nov 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing Startup form before opening application

Hi,

I am working on one requirement where application has two forms. Now there are two modes to open this application, one when user directly open it by selecting accde file and other when another application opens this file through VBA code.

The code written to open app is:

Dim appAccess As New Access.Application
Set appAccess = CreateObject("Access.Application")

appAccess.OpenCurrentDatabase "ABC.accde"
appAccess.TempVars.Add "strAppName", "XYZ"
appAccess.Visible = True

DoEvents


Basically I want to track if app is opened from user interaction or from other app.
Since there is user interaction I have to set Startup form. But that has to be dynamic.

I thought of creating one blank form which will see if TempVar is available or not in Form_Load and decide on which form to open.
But I don't get TempVar inside Form_Load becuase this event occures when calling OpenCurrentDatabase method.

Is there any way we can change file startup form property before opening it?
Or is there any event available in for which is delayed and occures after setting TempVar and also occurs even if TempVars are not set?

I have tried another solution with timer which starts in form load for 2 seconds, and assuming that within 2 sec TempVars are set and then doing operation in Form_Timer method. This works but we are reluctant to go with this approach.

Your help is greatly appreciated.

Thanks & Regards,
Shailesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set a form as startup form in vb.net 2.0 mallikalapati .NET Framework 2.0 1 February 21st, 2008 09:19 AM
Setting my Application as Startup in WinXp Venkatachalam ASP.NET 2.0 Professional 1 February 4th, 2008 11:28 AM
How to get rid of everything except startup form. biglazy Access 9 March 23rd, 2006 07:33 PM
MS Access Application Startup arnniema Access 6 September 2nd, 2005 10:39 AM
SWF File Plays On Application Startup Ben Horne Access VBA 0 November 19th, 2003 04:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.