473,323 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Programatically Set Startup Form

How can I programatically set the startup form when the database opens?

Thanks!

Steve
Nov 13 '05 #1
10 16040
PC Datasheet wrote:
How can I programatically set the startup form when the database opens?

Thanks!

Steve


1) Thanks for your help on my sorting question

2) How about have a start up form that's not intended to be opened with
the following in the on open event. the criteria could be based on the
network user name, whether a connection to the backend is able to be
made (test with a simple recordset open), etc, etc, all run before the
air code select statement below.

dim strOpenForm as string

select case <some criteria>

case 1

stropenform = "form1"

case 2

stropenform = "form2"

case else

stropenform = "whatever"

end select

cancel = true 'cancel opening of this form (or hide it for value storage)

docmd.openform stropenForm
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #2
Tim,

Thanks for your response!

You can go to Tools -Startup and set "MyForn" to open when the database
opens, How do you do this programatically?

Steve
"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:dj**********@coranto.ucs.mun.ca...
PC Datasheet wrote:
How can I programatically set the startup form when the database opens?

Thanks!

Steve


1) Thanks for your help on my sorting question

2) How about have a start up form that's not intended to be opened with
the following in the on open event. the criteria could be based on the
network user name, whether a connection to the backend is able to be made
(test with a simple recordset open), etc, etc, all run before the air code
select statement below.

dim strOpenForm as string
select case <some criteria>

case 1

stropenform = "form1"

case 2

stropenform = "form2"

case else

stropenform = "whatever"

end select

cancel = true 'cancel opening of this form (or hide it for value storage)

docmd.openform stropenForm
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me

Nov 13 '05 #3

"PC Datasheet" <no****@nospam.spam> schreef in bericht news:Ye**************@newsread3.news.atl.earthlink .net...
How can I programatically set the startup form when the database opens?

Thanks!

Steve


ChangeProperty "StartupForm", dbText, "YourFormName"

Private Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Boolean
Dim db As Database, prp As Property
Const conPropNotFoundError = 3270
On Error GoTo Change_Err
Set db = CurrentDb
db.Properties(strPropName) = varPropValue
ChangeProperty = True
Exit Function

Change_Err:
If Err = conPropNotFoundError Then
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
ChangeProperty = False
Exit Function
End If
End Function

If the property does not exist yet, it will be created.

Arno R
Nov 13 '05 #4
Create a macro called AutoExec.

Insert an OpenForm command, and enter the name of the form you want to
appear when Access opens.

There are many other things you can do on startup from the AutoExec
macro. Look at the command list to get an idea.

Bob

Nov 13 '05 #5
Thank you!

This falls squarely upon the intent of the newsgroups; ie, to provide help
to Access users.

Now why can't you continue to be a decent human being.

Steve
"Arno R" <ar***********@tiscali.nl> wrote in message
news:43********************@dreader2.news.tiscali. nl...

"PC Datasheet" <no****@nospam.spam> schreef in bericht
news:Ye**************@newsread3.news.atl.earthlink .net...
How can I programatically set the startup form when the database opens?

Thanks!

Steve


ChangeProperty "StartupForm", dbText, "YourFormName"

Private Function ChangeProperty(strPropName As String, varPropType As
Variant, varPropValue As Variant) As Boolean
Dim db As Database, prp As Property
Const conPropNotFoundError = 3270
On Error GoTo Change_Err
Set db = CurrentDb
db.Properties(strPropName) = varPropValue
ChangeProperty = True
Exit Function

Change_Err:
If Err = conPropNotFoundError Then
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
ChangeProperty = False
Exit Function
End If
End Function

If the property does not exist yet, it will be created.

Arno R
Nov 13 '05 #6

"PC Datasheet" <no****@nospam.spam> schreef in bericht news:G2******************@newsread1.news.atl.earth link.net...
Thank you!

This falls squarely upon the intent of the newsgroups; ie, to provide help
to Access users.

One minor adjustment:
The newsgroups intent is to provide *free* help to Access users.
Now why can't you continue to be a decent human being.


It's your turn to be decent.

Arno R
Nov 13 '05 #7
"PC Datasheet" <no****@nospam.spam> wrote in
news:p%***************@newsread3.news.atl.earthlin k.net:
You can go to Tools -Startup and set "MyForn" to open when the
database opens, How do you do this programatically?


Look up CUSTOM PROPERTIES in Access Help. There's code there to set
custom properties.

Keep in mind that most Access properties don't actually exist until
you set a value. Thus, you can't programmatically set the startup
form until you've actually created that property. The code example
in the help file does exactly that, with a SetCustomProperty
function that works both when the property already exists and when
it doesn't (it uses an error handler to create the property if it
doesn't yet exist).

The code for changing the the property once it's been created is
actually quite trivial:

CurrentDB.Properties("StartupForm") = "MyForm"

I'm not sure where you can get a list of the official property
names, though. You can't just loop through the Properties collection
and output the names in the Debug Window, because the properties
aren't there until a value has been set.

Here's a list of the property names for the properties in the
Startup dialog:

Application Title AppTitle
Application Icon AppIcon
Display Form/Page StartupForm
Display Database Window StartupShowDBWindow
Display Status Bar StartupShowStatusBar
Menu Bar StartupMenuBar
Shortcut Menu Bar StartupShortcutMenuBar
Allow Full Menus AllowFullMenus
Allow Default Shortcut Menus AllowShortcutMenus
Allow Built-In Toolbars AllowBuiltInToolbars
Allow Toolbar/Menu Changes AllowToolbarChanges
Allow Viewing Code After Error AllowBreakIntoCode
Use Access Special Keys AllowSpecialKeys

I suspect that comes from a help topic somewhere, but I can't locate
it -- I'm just copying this from comments I've included in code
where I set the startup properties.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #8
"PC Datasheet" <no****@nospam.spam> wrote in
news:G2******************@newsread1.news.atl.earth link.net:
This falls squarely upon the intent of the newsgroups; ie, to
provide help to Access users.
You should have checked the Access help files before posting, as
Arno just quoted from the help files.
Now why can't you continue to be a decent human being.


This makes you look like a first-class asshole.

You know that this newsgroup's charter prohibits solitation, yet you
flout those rules anyway. Nonetheless, you expect to get help when
you have a problem.

While I don't think there's any point in trying to get you to stop
soliciting (it's been tried too many times in the past and you're
always too stubborn to change), I think it's pretty assholish to
solicit and then expect to be treated well by the other posters in
the newsgroup.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #9
Good link to find out what the startup and other options you
programatically set.

http://msdn.microsoft.com/library/de...HV05188062.asp

Nov 13 '05 #10
Good links to find statrup and other options you can Set or Get. Hope
this help I am sure it will.

Set Options from Visual Basic [Access 2003 VBA Language Reference]

http://msdn.microsoft.com/library/de...HV05188062.asp

Set Startup Properties from Visual Basic [Access 2003 VBA Language
Reference]

http://msdn.microsoft.com/library/de...HV05188072.asp

loringdo

Nov 13 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: mark s | last post by:
How can I make a checkbox that says "Do not show this again at startup" on my reminder form? Thanks! -- name: Mark S. email: huskie_009@hotmail.com *** Sent via Developersdex...
1
by: Susan | last post by:
I have a bound form and subform and am trying to enter the data in both forms programatically. The Linkmaster and Linkchild properties are set. My intent is to be able to look at the data before it...
7
by: cefrancke | last post by:
I cant seem to find a straight answer on the following. I want to programmatically hide all menus except a basic custom report menu (during report preview) and right click pop-up A-Z sorting on...
1
by: cefrancke | last post by:
I have set the Startup properties to the following... All menus, toolbars, etc are turned off plus these are unchecked Allow Full Menus Allow Built-in Toolbars Allow Default Shortcut Menus...
4
by: Tony Vitonis | last post by:
Hello. I've written an app that I want to "live" in the system tray. I want it to start up with just a tray icon showing, and if the user selects "Settings..." from the icon's context menu, to...
4
by: Johnnie Miami | last post by:
I'm using VB.Net 2005 beta 2 and have my login form (login.vb) specified as the startup form. If the user is successful logging in, I call my main form (main.vb). This all works fine but the...
10
by: Bernie Hunt | last post by:
This is probably a silly question, but I've gotten myself confused. My app has two forms, form1 and form2. form1 is the start up object in the propers. An event in form1 instantiates form2. ...
10
by: =?Utf-8?B?UmljaGFyZCBCeXNvdXRo?= | last post by:
Hi In my app I have a SplashScreen, a login form and a main form. On launching the app, I'd like to show the SplashScreen while reading config files and attempting a database connection. I show...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
I need to programatically upload a text file to a web server using the HTTPWebRequest object within .Net 2.0. So far, I have determined that: - I need a HTTP content-type of...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.