|
 |
access thread: beanbo69
Message #1 by "Kevin Crider" <criderkevin@a...> on Fri, 23 Aug 2002 21:01:12
|
|
Hi All!
I am getting errors in Access XP when I try to set the StartUpForm thru
VBA. Apparently the code I have is not entirely correct...does anyone know
the correct code for this? Have these properties changed since Access
2000? I am using the following...
Sub SET_SUF
If Usr1 = "Kevin" Then
CurrentDb.Properties("StartUpForm") = "frmKEV"
Else
etc.
End If
End Sub
Ideally this routine would set one of 5 different forms depending on the
user. In addition to the StartUpForm I may need to change other start up
properties as well...
Thanks for HELP!
Kevin
Message #2 by "Amy Wyatt" <amyw@c...> on Wed, 28 Aug 2002 14:36:06
|
|
I have never set the Start up form from code but it seems to me that by
the time you run the code the startup sequence has already fired and
therefore any changes would only apply the next time you start up. Try
running the open form from code that is fired on an autoexec macro.
Select Case Usr1
Case "Kevin"
Docmd.OpenForm "frmKev"
Case "Joe"
...
End Select
Hope this helps.
Amy
> Hi All!
> I am getting errors in Access XP when I try to set the StartUpForm thru
V> BA. Apparently the code I have is not entirely correct...does anyone
know
t> he correct code for this? Have these properties changed since Access
2> 000? I am using the following...
> Sub SET_SUF
I> f Usr1 = "Kevin" Then
> CurrentDb.Properties("StartUpForm") = "frmKEV"
E> lse
> etc.
E> nd If
E> nd Sub
> Ideally this routine would set one of 5 different forms depending on the
u> ser. In addition to the StartUpForm I may need to change other start up
p> roperties as well...
> Thanks for HELP!
> Kevin
Message #3 by "Kevin Crider" <criderkevin@a...> on Wed, 28 Aug 2002 18:21:55
|
|
The problem is that I have a VB6 program that updates the Access DB with
different data depending on the user. So, say for user "Kevin" only XYZ
Company, Inc. data is updated, and user "Kevins" startup form is set to
the "frmXYZ". However, if user "Joe" logs in and updates data, he gets ABC
Company, Inc. data updated and the start-up form is set to "frmABC". That
way the same access DB tables are used for the 2 companies - only
difference is what the user sees - the startup form. There is no log-in in
the Access piece - nor do I really want an Access log-in or to have to
distinguish between users in Access. The user simply logs-in to the VB6
program, then clicks update. The program opens Access in the background,
runs the update tables routine, then compacts & repairs - and ideally sets
the startup form.
> I have never set the Start up form from code but it seems to me that by
t> he time you run the code the startup sequence has already fired and
t> herefore any changes would only apply the next time you start up. Try
r> unning the open form from code that is fired on an autoexec macro.
> Select Case Usr1
> Case "Kevin"
> Docmd.OpenForm "frmKev"
> Case "Joe"
> ...
E> nd Select
> Hope this helps.
> Amy
>
> > Hi All!
> > I am getting errors in Access XP when I try to set the StartUpForm
thru
V> > BA. Apparently the code I have is not entirely correct...does anyone
k> now
t> > he correct code for this? Have these properties changed since Access
2> > 000? I am using the following...
> > Sub SET_SUF
I> > f Usr1 = "Kevin" Then
> > CurrentDb.Properties("StartUpForm") = "frmKEV"
E> > lse
> > etc.
E> > nd If
E> > nd Sub
> > Ideally this routine would set one of 5 different forms depending on
the
u> > ser. In addition to the StartUpForm I may need to change other start
up
p> > roperties as well...
> > Thanks for HELP!
> > Kevin
Message #4 by "Leo Scott" <leoscott@c...> on Wed, 28 Aug 2002 10:27:53 -0700
|
|
Are the forms in Access almost identical? I would then just store the last
user name in a table and when access opens have the form look at last user
name and configure itself accordingly. If the forms are identical it would
probably be just a matter of setting the forms Filter property to the
correct company.
|-----Original Message-----
|From: Kevin Crider [mailto:criderkevin@a...]
|Sent: Wednesday, August 28, 2002 6:22 PM
|To: Access
|Subject: [access] Re: beanbo69
|
|
|The problem is that I have a VB6 program that updates the Access DB with
|different data depending on the user. So, say for user "Kevin" only XYZ
|Company, Inc. data is updated, and user "Kevins" startup form is set to
|the "frmXYZ". However, if user "Joe" logs in and updates data, he gets ABC
|Company, Inc. data updated and the start-up form is set to "frmABC". That
|way the same access DB tables are used for the 2 companies - only
|difference is what the user sees - the startup form. There is no log-in in
|the Access piece - nor do I really want an Access log-in or to have to
|distinguish between users in Access. The user simply logs-in to the VB6
|program, then clicks update. The program opens Access in the background,
|runs the update tables routine, then compacts & repairs - and ideally sets
|the startup form.
|
|
|
|> I have never set the Start up form from code but it seems to me that by
|t> he time you run the code the startup sequence has already fired and
|t> herefore any changes would only apply the next time you start up. Try
|r> unning the open form from code that is fired on an autoexec macro.
|
|> Select Case Usr1
| > Case "Kevin"
| > Docmd.OpenForm "frmKev"
|
|> Case "Joe"
| > ...
|E> nd Select
|
|> Hope this helps.
|
|> Amy
| >
|
|> > Hi All!
|
|> > I am getting errors in Access XP when I try to set the StartUpForm
|thru
|V> > BA. Apparently the code I have is not entirely correct...does anyone
|k> now
|t> > he correct code for this? Have these properties changed since Access
|2> > 000? I am using the following...
|
|> > Sub SET_SUF
|I> > f Usr1 = "Kevin" Then
| > > CurrentDb.Properties("StartUpForm") = "frmKEV"
|E> > lse
| > > etc.
|E> > nd If
|E> > nd Sub
|
|> > Ideally this routine would set one of 5 different forms depending on
|the
|u> > ser. In addition to the StartUpForm I may need to change other start
|up
|p> > roperties as well...
|
|> > Thanks for HELP!
|
|> > Kevin
Message #5 by "Carnley, Dave" <dcarnley@a...> on Wed, 28 Aug 2002 13:46:15 -0500
|
|
This seems like a good case in point as to why you should separate your
business logic from your presentation (GUI) code.
Abstractly, it seems you are trying to use the startup form property as a
way of passing a parameter to the logic within the access db, telling it
which company it should work with. Perhaps there is a better way to do that
than changing the startup form property. Maybe there is another property or
maybe you could use ADO to write a record to a local table in the db before
you "open" it and a generic, hidden startup form could read that and then
display the appropriate "user startup" form. (Sorry for the run-on sentence
haha)
-----Original Message-----
From: Kevin Crider [mailto:criderkevin@a...]
Sent: Wednesday, August 28, 2002 1:22 PM
To: Access
Subject: [access] Re: beanbo69
The problem is that I have a VB6 program that updates the Access DB with
different data depending on the user. So, say for user "Kevin" only XYZ
Company, Inc. data is updated, and user "Kevins" startup form is set to
the "frmXYZ". However, if user "Joe" logs in and updates data, he gets ABC
Company, Inc. data updated and the start-up form is set to "frmABC". That
way the same access DB tables are used for the 2 companies - only
difference is what the user sees - the startup form. There is no log-in in
the Access piece - nor do I really want an Access log-in or to have to
distinguish between users in Access. The user simply logs-in to the VB6
program, then clicks update. The program opens Access in the background,
runs the update tables routine, then compacts & repairs - and ideally sets
the startup form.
> I have never set the Start up form from code but it seems to me that by
t> he time you run the code the startup sequence has already fired and
t> herefore any changes would only apply the next time you start up. Try
r> unning the open form from code that is fired on an autoexec macro.
> Select Case Usr1
> Case "Kevin"
> Docmd.OpenForm "frmKev"
> Case "Joe"
> ...
E> nd Select
> Hope this helps.
> Amy
>
> > Hi All!
> > I am getting errors in Access XP when I try to set the StartUpForm
thru
V> > BA. Apparently the code I have is not entirely correct...does anyone
k> now
t> > he correct code for this? Have these properties changed since Access
2> > 000? I am using the following...
> > Sub SET_SUF
I> > f Usr1 = "Kevin" Then
> > CurrentDb.Properties("StartUpForm") = "frmKEV"
E> > lse
> > etc.
E> > nd If
E> > nd Sub
> > Ideally this routine would set one of 5 different forms depending on
the
u> > ser. In addition to the StartUpForm I may need to change other start
up
p> > roperties as well...
> > Thanks for HELP!
> > Kevin
|
|
 |