PC Review


Reply
Thread Tools Rate Thread

Create a StartupForm property

 
 
Rob
Guest
Posts: n/a
 
      2nd Oct 2008
I have Access build a new database and wish to have the new database
auto-open a particular form. I am trying to do this by creating a new
property in the new db. Here's the relevant code:

Dim updaterDB as Database
Set updaterDB = OpenDatabase("MyNewDatabase")
Dim newProp as Property
Set newProp = updaterDB.Properties.CreateProperty
With newProp
.Name = "StartupForm"
.Type = 10
.Value = "Form.MainForm"
End With
updaterDB.Properties.Append (newProp)


When I get to the last line above, I get an RTE "Object Required". What am
I doing wrong?

Thanks,

 
Reply With Quote
 
 
 
 
Jim Burke in Novi
Guest
Posts: n/a
 
      2nd Oct 2008
Just use Tools, Startup to specify your startup form. No need to do it in code.

"Rob" wrote:

> I have Access build a new database and wish to have the new database
> auto-open a particular form. I am trying to do this by creating a new
> property in the new db. Here's the relevant code:
>
> Dim updaterDB as Database
> Set updaterDB = OpenDatabase("MyNewDatabase")
> Dim newProp as Property
> Set newProp = updaterDB.Properties.CreateProperty
> With newProp
> .Name = "StartupForm"
> .Type = 10
> .Value = "Form.MainForm"
> End With
> updaterDB.Properties.Append (newProp)
>
>
> When I get to the last line above, I get an RTE "Object Required". What am
> I doing wrong?
>
> Thanks,
>

 
Reply With Quote
 
Rob
Guest
Posts: n/a
 
      2nd Oct 2008
Actually, there is. I don't want the users to have to do it themselves
(which they'll have to under your recommendation).

I do have a correction in the code below... the fourth line should read:
Set newProp = updaterDB.CreateProperty

Thanks again,

Rob


"Jim Burke in Novi" wrote:

> Just use Tools, Startup to specify your startup form. No need to do it in code.
>
> "Rob" wrote:
>
> > I have Access build a new database and wish to have the new database
> > auto-open a particular form. I am trying to do this by creating a new
> > property in the new db. Here's the relevant code:
> >
> > Dim updaterDB as Database
> > Set updaterDB = OpenDatabase("MyNewDatabase")
> > Dim newProp as Property
> > Set newProp = updaterDB.Properties.CreateProperty
> > With newProp
> > .Name = "StartupForm"
> > .Type = 10
> > .Value = "Form.MainForm"
> > End With
> > updaterDB.Properties.Append (newProp)
> >
> >
> > When I get to the last line above, I get an RTE "Object Required". What am
> > I doing wrong?
> >
> > Thanks,
> >

 
Reply With Quote
 
Jim Burke in Novi
Guest
Posts: n/a
 
      3rd Oct 2008
Does each user have the option of starting at a different form? If so, you
need some sort of logic somewhere to determine which form gets opened,
whether it be in code or in a table. And unless I'm mistaken about Access's
startup, any logic to change the startup form can't happen until startup has
already occurred. Maybe I'm missing something. If you need each user to have
an option of what form to be presented with, even if you have a table with
userid and form name, you still have to have logic at some point to determine
that. If you have something like that, I'd create an autoexec macro that
calls a function, have that function find the appropriate startup form for
that user and then open that form.

If all users are presented with the same startup form, then Tools, Options
-> Startup is what you would use. There is no user intervention with that.
You set it yourself, then once the appl is sent to the users, the option is
already set. Maybe I don't understand what it is you're trying to do.

"Rob" wrote:

> Actually, there is. I don't want the users to have to do it themselves
> (which they'll have to under your recommendation).
>
> I do have a correction in the code below... the fourth line should read:
> Set newProp = updaterDB.CreateProperty
>
> Thanks again,
>
> Rob
>
>
> "Jim Burke in Novi" wrote:
>
> > Just use Tools, Startup to specify your startup form. No need to do it in code.
> >
> > "Rob" wrote:
> >
> > > I have Access build a new database and wish to have the new database
> > > auto-open a particular form. I am trying to do this by creating a new
> > > property in the new db. Here's the relevant code:
> > >
> > > Dim updaterDB as Database
> > > Set updaterDB = OpenDatabase("MyNewDatabase")
> > > Dim newProp as Property
> > > Set newProp = updaterDB.Properties.CreateProperty
> > > With newProp
> > > .Name = "StartupForm"
> > > .Type = 10
> > > .Value = "Form.MainForm"
> > > End With
> > > updaterDB.Properties.Append (newProp)
> > >
> > >
> > > When I get to the last line above, I get an RTE "Object Required". What am
> > > I doing wrong?
> > >
> > > Thanks,
> > >

 
Reply With Quote
 
Rob
Guest
Posts: n/a
 
      3rd Oct 2008
Jim,

Sorry I didn't expound much on the purpose. The idea is that the users run
some code which generates (creates) a new database. Part of that code
builds the MainForm form into the new database and *should* make the MainForm
form the Startup Form. The resulting database is used by those users and
users down the line, but I don't get involved with that process. I don't
want to force (in fact, I don't even want to *let*) the users change the
startup form. I am wary of using an autoexec macro; I think that's a clumsy
(and a bit unstable) method for doing what should be available to be done
using the Properties collection.

Thus, I think my approach is generally correct, and I'm probably only off by
a bit of syntax. I don't completely understand creating Properties in
general, but I've managed to do it in the past (for example, the same code
builds relationships in the new DB and uses the CreateProperty method to
properly connect related tables).

Thanks again for any help,
Rob

"Jim Burke in Novi" wrote:

> Does each user have the option of starting at a different form? If so, you
> need some sort of logic somewhere to determine which form gets opened,
> whether it be in code or in a table. And unless I'm mistaken about Access's
> startup, any logic to change the startup form can't happen until startup has
> already occurred. Maybe I'm missing something. If you need each user to have
> an option of what form to be presented with, even if you have a table with
> userid and form name, you still have to have logic at some point to determine
> that. If you have something like that, I'd create an autoexec macro that
> calls a function, have that function find the appropriate startup form for
> that user and then open that form.
>
> If all users are presented with the same startup form, then Tools, Options
> -> Startup is what you would use. There is no user intervention with that.
> You set it yourself, then once the appl is sent to the users, the option is
> already set. Maybe I don't understand what it is you're trying to do.
>
> "Rob" wrote:
>
> > Actually, there is. I don't want the users to have to do it themselves
> > (which they'll have to under your recommendation).
> >
> > I do have a correction in the code below... the fourth line should read:
> > Set newProp = updaterDB.CreateProperty
> >
> > Thanks again,
> >
> > Rob
> >
> >
> > "Jim Burke in Novi" wrote:
> >
> > > Just use Tools, Startup to specify your startup form. No need to do it in code.
> > >
> > > "Rob" wrote:
> > >
> > > > I have Access build a new database and wish to have the new database
> > > > auto-open a particular form. I am trying to do this by creating a new
> > > > property in the new db. Here's the relevant code:
> > > >
> > > > Dim updaterDB as Database
> > > > Set updaterDB = OpenDatabase("MyNewDatabase")
> > > > Dim newProp as Property
> > > > Set newProp = updaterDB.Properties.CreateProperty
> > > > With newProp
> > > > .Name = "StartupForm"
> > > > .Type = 10
> > > > .Value = "Form.MainForm"
> > > > End With
> > > > updaterDB.Properties.Append (newProp)
> > > >
> > > >
> > > > When I get to the last line above, I get an RTE "Object Required". What am
> > > > I doing wrong?
> > > >
> > > > Thanks,
> > > >

 
Reply With Quote
 
Jim Burke in Novi
Guest
Posts: n/a
 
      3rd Oct 2008
I think the Value parameter is simply the form name. Try

..Value = "MainForm"

"Rob" wrote:

> Jim,
>
> Sorry I didn't expound much on the purpose. The idea is that the users run
> some code which generates (creates) a new database. Part of that code
> builds the MainForm form into the new database and *should* make the MainForm
> form the Startup Form. The resulting database is used by those users and
> users down the line, but I don't get involved with that process. I don't
> want to force (in fact, I don't even want to *let*) the users change the
> startup form. I am wary of using an autoexec macro; I think that's a clumsy
> (and a bit unstable) method for doing what should be available to be done
> using the Properties collection.
>
> Thus, I think my approach is generally correct, and I'm probably only off by
> a bit of syntax. I don't completely understand creating Properties in
> general, but I've managed to do it in the past (for example, the same code
> builds relationships in the new DB and uses the CreateProperty method to
> properly connect related tables).
>
> Thanks again for any help,
> Rob
>
> "Jim Burke in Novi" wrote:
>
> > Does each user have the option of starting at a different form? If so, you
> > need some sort of logic somewhere to determine which form gets opened,
> > whether it be in code or in a table. And unless I'm mistaken about Access's
> > startup, any logic to change the startup form can't happen until startup has
> > already occurred. Maybe I'm missing something. If you need each user to have
> > an option of what form to be presented with, even if you have a table with
> > userid and form name, you still have to have logic at some point to determine
> > that. If you have something like that, I'd create an autoexec macro that
> > calls a function, have that function find the appropriate startup form for
> > that user and then open that form.
> >
> > If all users are presented with the same startup form, then Tools, Options
> > -> Startup is what you would use. There is no user intervention with that.
> > You set it yourself, then once the appl is sent to the users, the option is
> > already set. Maybe I don't understand what it is you're trying to do.
> >
> > "Rob" wrote:
> >
> > > Actually, there is. I don't want the users to have to do it themselves
> > > (which they'll have to under your recommendation).
> > >
> > > I do have a correction in the code below... the fourth line should read:
> > > Set newProp = updaterDB.CreateProperty
> > >
> > > Thanks again,
> > >
> > > Rob
> > >
> > >
> > > "Jim Burke in Novi" wrote:
> > >
> > > > Just use Tools, Startup to specify your startup form. No need to do it in code.
> > > >
> > > > "Rob" wrote:
> > > >
> > > > > I have Access build a new database and wish to have the new database
> > > > > auto-open a particular form. I am trying to do this by creating a new
> > > > > property in the new db. Here's the relevant code:
> > > > >
> > > > > Dim updaterDB as Database
> > > > > Set updaterDB = OpenDatabase("MyNewDatabase")
> > > > > Dim newProp as Property
> > > > > Set newProp = updaterDB.Properties.CreateProperty
> > > > > With newProp
> > > > > .Name = "StartupForm"
> > > > > .Type = 10
> > > > > .Value = "Form.MainForm"
> > > > > End With
> > > > > updaterDB.Properties.Append (newProp)
> > > > >
> > > > >
> > > > > When I get to the last line above, I get an RTE "Object Required". What am
> > > > > I doing wrong?
> > > > >
> > > > > Thanks,
> > > > >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Property on the fly Marc Robitaille Microsoft VB .NET 6 30th Nov 2006 02:48 PM
StartupForm based on results of query =?Utf-8?B?REVX?= Microsoft Access Forms 1 15th Mar 2005 08:50 AM
Re: Can I create a delegate for a property? Richard Grimes [MVP] Microsoft Dot NET Framework 0 14th Oct 2004 03:59 PM
Re: Can I create a delegate for a property? Ravichandran J.V. Microsoft Dot NET Framework 0 21st Sep 2004 12:51 PM
Can I create a delegate for a property? =?Utf-8?B?SGFycnkgS2Vjaw==?= Microsoft Dot NET Framework 0 20th Sep 2004 02:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:28 PM.