Connecting Tech Pros Worldwide Help | Site Map

Open Access Options without displaying database window

dixie
Guest
 
Posts: n/a
#1: Nov 13 '05
I have a command to open the Access Options dialogue from code:

DoCmd.RunCommand acCmdOptions

It also opens the Database Window behind it. Is it possible to open the
Options without having the database window open as well?

dixie


Albert D. Kallal
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Open Access Options without displaying database window


Do you really need to open the database options dialog?

The above sounds like a rather strange need.

You can certainly control a lot of options via code. Perhaps you might just
create a un-bound form, and build you open custom options form?

I would as rule stay away from having "users" to setup options, usually you
can set things up before hand. I would be quite nervous about opening the
database options and exposing so many features to my users. A good portion
of those options are quite advanced, and no end user has any business
messing with that stuff..


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.attcanada.net/~kallal.msn


dixie
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Open Access Options without displaying database window


The thing I want to achieve is to allow the setting of Confirm Action
Queries to false. If I can achieve this in code, that is a much better
solution. How can it be done?

dixie

"Albert D. Kallal" <PleaseNOOOsPAMMkallal@msn.com> wrote in message
news:qpztc.605434$oR5.274777@pd7tw3no...[color=blue]
> Do you really need to open the database options dialog?
>
> The above sounds like a rather strange need.
>
> You can certainly control a lot of options via code. Perhaps you might[/color]
just[color=blue]
> create a un-bound form, and build you open custom options form?
>
> I would as rule stay away from having "users" to setup options, usually[/color]
you[color=blue]
> can set things up before hand. I would be quite nervous about opening the
> database options and exposing so many features to my users. A good portion
> of those options are quite advanced, and no end user has any business
> messing with that stuff..
>
>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOOSpamKallal@msn.com
> http://www.attcanada.net/~kallal.msn
>
>[/color]


Reggie
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Open Access Options without displaying database window


Dixie, you can to warnings of via code, but you must make sure to turn them
back on via code or warnings you may want to see will not show up.

Private Sub cmdMyButton_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryMyActionQuery", acNormal, acEdit
DoCmd.SetWarnings True
End Sub
--
Reggie

www.smittysinet.com
----------
"dixie" <dixiec@dogmail.com> wrote in message
news:uCAtc.118$Ix2.2989@nnrp1.ozemail.com.au...[color=blue]
> The thing I want to achieve is to allow the setting of Confirm Action
> Queries to false. If I can achieve this in code, that is a much better
> solution. How can it be done?
>
> dixie
>
> "Albert D. Kallal" <PleaseNOOOsPAMMkallal@msn.com> wrote in message
> news:qpztc.605434$oR5.274777@pd7tw3no...[color=green]
> > Do you really need to open the database options dialog?
> >
> > The above sounds like a rather strange need.
> >
> > You can certainly control a lot of options via code. Perhaps you might[/color]
> just[color=green]
> > create a un-bound form, and build you open custom options form?
> >
> > I would as rule stay away from having "users" to setup options, usually[/color]
> you[color=green]
> > can set things up before hand. I would be quite nervous about opening[/color][/color]
the[color=blue][color=green]
> > database options and exposing so many features to my users. A good[/color][/color]
portion[color=blue][color=green]
> > of those options are quite advanced, and no end user has any business
> > messing with that stuff..
> >
> >
> > --
> > Albert D. Kallal (Access MVP)
> > Edmonton, Alberta Canada
> > pleaseNOOSpamKallal@msn.com
> > http://www.attcanada.net/~kallal.msn
> >
> >[/color]
>
>[/color]


dixie
Guest
 
Posts: n/a
#5: Nov 13 '05

re: Open Access Options without displaying database window


I know I can do this Reggie, but I was looking for a way to turn off the
Action Query Confirmation only at the start of my program opening, as I
don't want it activated at any time. I do however wish to confirm Record
Changes and Document deletions.

The program runs on a remote site and they have their Confirm Action Queries
True by default. I just thought that if I could get it turned off in code,
it would circumvent the problem of having to turn warnings on and off every
time an action query runs.

dixie

"Reggie" <nospam_chief@smittysinet.com> wrote in message
news:iNednVu1AbvDdivdRVn-hw@comcast.com...[color=blue]
> Dixie, you can to warnings of via code, but you must make sure to turn[/color]
them[color=blue]
> back on via code or warnings you may want to see will not show up.
>
> Private Sub cmdMyButton_Click()
> DoCmd.SetWarnings False
> DoCmd.OpenQuery "qryMyActionQuery", acNormal, acEdit
> DoCmd.SetWarnings True
> End Sub
> --
> Reggie
>
> www.smittysinet.com
> ----------
> "dixie" <dixiec@dogmail.com> wrote in message
> news:uCAtc.118$Ix2.2989@nnrp1.ozemail.com.au...[color=green]
> > The thing I want to achieve is to allow the setting of Confirm Action
> > Queries to false. If I can achieve this in code, that is a much better
> > solution. How can it be done?
> >
> > dixie
> >
> > "Albert D. Kallal" <PleaseNOOOsPAMMkallal@msn.com> wrote in message
> > news:qpztc.605434$oR5.274777@pd7tw3no...[color=darkred]
> > > Do you really need to open the database options dialog?
> > >
> > > The above sounds like a rather strange need.
> > >
> > > You can certainly control a lot of options via code. Perhaps you might[/color]
> > just[color=darkred]
> > > create a un-bound form, and build you open custom options form?
> > >
> > > I would as rule stay away from having "users" to setup options,[/color][/color][/color]
usually[color=blue][color=green]
> > you[color=darkred]
> > > can set things up before hand. I would be quite nervous about opening[/color][/color]
> the[color=green][color=darkred]
> > > database options and exposing so many features to my users. A good[/color][/color]
> portion[color=green][color=darkred]
> > > of those options are quite advanced, and no end user has any business
> > > messing with that stuff..
> > >
> > >
> > > --
> > > Albert D. Kallal (Access MVP)
> > > Edmonton, Alberta Canada
> > > pleaseNOOSpamKallal@msn.com
> > > http://www.attcanada.net/~kallal.msn
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Rick Brandt
Guest
 
Posts: n/a
#6: Nov 13 '05

re: Open Access Options without displaying database window


"dixie" <dixiec@dogmail.com> wrote in message
news:uJCtc.266$Ix2.4203@nnrp1.ozemail.com.au...[color=blue]
> I know I can do this Reggie, but I was looking for a way to turn off the
> Action Query Confirmation only at the start of my program opening, as I
> don't want it activated at any time. I do however wish to confirm Record
> Changes and Document deletions.
>
> The program runs on a remote site and they have their Confirm Action Queries
> True by default. I just thought that if I could get it turned off in code,
> it would circumvent the problem of having to turn warnings on and off every
> time an action query runs.[/color]

Do these people use no other Access apps besides yours? What your proposing
would turn off confirmations for all apps which could very well NOT be
appreciated by those users. It is fine to make *your* app run the way you want,
but don't mess with global user settings.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


Don Leverton
Guest
 
Posts: n/a
#7: Nov 13 '05

re: Open Access Options without displaying database window


Hi Dixie,

If you can live with running these action queries from a form, rather than
executing them from the database window directly...
I'd suggest using the .Execute Method as below. There are no confirmation
messages nor any risk of leaving "SetWarnings = False" using this method.
----------------------------------------------------------------------------
----------
There are at least a couple of ways to implement this ... (Modifying
Reggie's code here)

1.) Run a saved action query
-----------------------------
********************************************
Private Sub cmdMyButton_Click()

Dim MyDB As DAO.Database
Set MyDB = CurrentDb

MyDB.Execute "qryMyActionQuery", dbFailOnError
Set MyDB = Nothing

End Sub
********************************************

OR

2.) Build an SQL string in the code directly, and avoid having to even
*have* a saved query.
This is my personal preference, as there is no chance that someone will
accidentally run this query without understanding the consequences.

-- Of course you'll have to modify the "MySQL" string below to match the SQL
from your present query --
(Open your saved query in SQL view, then copy and paste it into the code
window for modifications.)
-----------------------------------------------------------
********************************************
Private Sub cmdMyButton_Click()

Dim MyDB As DAO.Database
Set MyDB = CurrentDb
Dim MySQL as String

MySQL = ""
MySQL = MySQL & "UPDATE tblPartsInventory SET "
MySQL = MySQL & "tblPartsInventory.Selected = False "
MySQL = MySQL & "WHERE (((tblPartsInventory.Selected)=True));"

MyDB.Execute MySQL, dbFailOnError
Set MyDB = Nothing

End Sub
********************************************
--
HTH,
Don
=============================
Use My.Name@Telus.Net for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================




"dixie" <dixiec@dogmail.com> wrote in message
news:uJCtc.266$Ix2.4203@nnrp1.ozemail.com.au...[color=blue]
> I know I can do this Reggie, but I was looking for a way to turn off the
> Action Query Confirmation only at the start of my program opening, as I
> don't want it activated at any time. I do however wish to confirm Record
> Changes and Document deletions.
>
> The program runs on a remote site and they have their Confirm Action[/color]
Queries[color=blue]
> True by default. I just thought that if I could get it turned off in[/color]
code,[color=blue]
> it would circumvent the problem of having to turn warnings on and off[/color]
every[color=blue]
> time an action query runs.
>
> dixie
>[/color]
< previous posts snipped> DL


Bob Quintal
Guest
 
Posts: n/a
#8: Nov 13 '05

re: Open Access Options without displaying database window


"dixie" <dixiec@dogmail.com> wrote in
news:WQytc.104$Ix2.2057@nnrp1.ozemail.com.au:
[color=blue]
> I have a command to open the Access Options dialogue from
> code:
>
> DoCmd.RunCommand acCmdOptions
>
> It also opens the Database Window behind it. Is it possible
> to open the Options without having the database window open as
> well?
>
> dixie
>
>[/color]
Dixie, those newbies who've responded don't know the very simple
way of turning these options off or on.

application.setoption("Confirm Action Queries",true)

Before you run it, you should store the existing setting to a
global variable, and set it back the way it was before leaving
the application.

bAction = application.getoption("Confirm Action Queries"

application.setoption("Confirm Action Queries",bAction)

One really useful value to play with is the "Behaviour Entering
Field" option. you can "Select entire field" or "go to end of
field" as the setting.

Bob Quintal

Rick Brandt
Guest
 
Posts: n/a
#9: Nov 13 '05

re: Open Access Options without displaying database window


"Bob Quintal" <bquintal@generation.net> wrote in message
news:94caa1c137d562ffbc85e158bfa69498@news.teranew s.com...[color=blue]
> "dixie" <dixiec@dogmail.com> wrote in
> news:WQytc.104$Ix2.2057@nnrp1.ozemail.com.au:
>[color=green]
> > I have a command to open the Access Options dialogue from
> > code:
> >
> > DoCmd.RunCommand acCmdOptions
> >
> > It also opens the Database Window behind it. Is it possible
> > to open the Options without having the database window open as
> > well?
> >
> > dixie
> >
> >[/color]
> Dixie, those newbies who've responded don't know the very simple
> way of turning these options off or on.[/color]

Actually I think that most "non-newbies" avoid DoCmd.RunSQL and DoCmd.OpenQuery
in the first place making the warnings a non-issue.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


Michael \(michka\) Kaplan [MS]
Guest
 
Posts: n/a
#10: Nov 13 '05

re: Open Access Options without displaying database window



"Rick Brandt" <rickbrandt2@hotmail.com> wrote...[color=blue]
> "Bob Quintal" <bquintal@generation.net> wrote...[color=green]
> > "dixie" <dixiec@dogmail.com> wrote:[/color][/color]
[color=blue][color=green][color=darkred]
> > > I have a command to open the Access Options dialogue from
> > > code:
> > >
> > > DoCmd.RunCommand acCmdOptions
> > >
> > > It also opens the Database Window behind it. Is it possible
> > > to open the Options without having the database window open as
> > > well?[/color][/color][/color]
[color=blue][color=green]
> > Dixie, those newbies who've responded don't know the very simple
> > way of turning these options off or on.[/color][/color]
[color=blue]
> Actually I think that most "non-newbies" avoid DoCmd.RunSQL and[/color]
DoCmd.OpenQuery[color=blue]
> in the first place making the warnings a non-issue.[/color]

And the "non-newbies" who do not do that use "DoCmd.SetWarnings False"
instead of changing the SetOption since the latter changes a user setting,
which is inappropriate to do without permission....


--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.


dixie
Guest
 
Posts: n/a
#11: Nov 13 '05

re: Open Access Options without displaying database window


Bob, your command:
application.setoption("Confirm Action Queries",true)
brings up a syntax error when I try to compile it. Can you see what the
problem is? This would be really nice as I can set it to false, and then
set it back at the end.

dixie

"Bob Quintal" <bquintal@generation.net> wrote in message
news:94caa1c137d562ffbc85e158bfa69498@news.teranew s.com...[color=blue]
> "dixie" <dixiec@dogmail.com> wrote in
> news:WQytc.104$Ix2.2057@nnrp1.ozemail.com.au:
>[color=green]
> > I have a command to open the Access Options dialogue from
> > code:
> >
> > DoCmd.RunCommand acCmdOptions
> >
> > It also opens the Database Window behind it. Is it possible
> > to open the Options without having the database window open as
> > well?
> >
> > dixie
> >
> >[/color]
> Dixie, those newbies who've responded don't know the very simple
> way of turning these options off or on.
>
> application.setoption("Confirm Action Queries",true)
>
> Before you run it, you should store the existing setting to a
> global variable, and set it back the way it was before leaving
> the application.
>
> bAction = application.getoption("Confirm Action Queries"
>
> application.setoption("Confirm Action Queries",bAction)
>
> One really useful value to play with is the "Behaviour Entering
> Field" option. you can "Select entire field" or "go to end of
> field" as the setting.
>
> Bob Quintal
>[/color]


Bob Quintal
Guest
 
Posts: n/a
#12: Nov 13 '05

re: Open Access Options without displaying database window


"dixie" <dixiec@dogmail.com> wrote in
news:RdWtc.466$Ix2.13163@nnrp1.ozemail.com.au:
[color=blue]
> Bob, your command:
> application.setoption("Confirm Action Queries",true)
> brings up a syntax error when I try to compile it. Can you
> see what the problem is? This would be really nice as I can
> set it to false, and then set it back at the end.
>
> dixie
>
> "Bob Quintal" <bquintal@generation.net> wrote in message
> news:94caa1c137d562ffbc85e158bfa69498@news.teranew s.com...[color=green]
>> "dixie" <dixiec@dogmail.com> wrote in
>> news:WQytc.104$Ix2.2057@nnrp1.ozemail.com.au:
>>[color=darkred]
>> > I have a command to open the Access Options dialogue from
>> > code:
>> >
>> > DoCmd.RunCommand acCmdOptions
>> >
>> > It also opens the Database Window behind it. Is it
>> > possible to open the Options without having the database
>> > window open as well?
>> >
>> > dixie
>> >[/color][/color][/color]
sorry, just remove the ()

Bob Quintal.


[color=blue][color=green]
>> Dixie, those newbies who've responded don't know the very
>> simple way of turning these options off or on.
>>
>> application.setoption("Confirm Action Queries",true)
>>
>> Before you run it, you should store the existing setting to a
>> global variable, and set it back the way it was before
>> leaving the application.
>>
>> bAction = application.getoption("Confirm Action Queries"
>>
>> application.setoption("Confirm Action Queries",bAction)
>>
>> One really useful value to play with is the "Behaviour
>> Entering Field" option. you can "Select entire field" or "go
>> to end of field" as the setting.
>>
>> Bob Quintal
>>[/color]
>
>[/color]

Bob Quintal
Guest
 
Posts: n/a
#13: Nov 13 '05

re: Open Access Options without displaying database window


"Michael \(michka\) Kaplan [MS]" <michkap@online.microsoft.com>
wrote in news:40b80fa7$1@news.microsoft.com:
[color=blue]
>
> "Rick Brandt" <rickbrandt2@hotmail.com> wrote...[color=green]
>> "Bob Quintal" <bquintal@generation.net> wrote...[color=darkred]
>> > "dixie" <dixiec@dogmail.com> wrote:[/color][/color]
>[color=green][color=darkred]
>> > > I have a command to open the Access Options dialogue from
>> > > code:
>> > >
>> > > DoCmd.RunCommand acCmdOptions
>> > >
>> > > It also opens the Database Window behind it. Is it
>> > > possible to open the Options without having the database
>> > > window open as well?[/color][/color]
>[color=green][color=darkred]
>> > Dixie, those newbies who've responded don't know the very
>> > simple way of turning these options off or on.[/color][/color]
>[color=green]
>> Actually I think that most "non-newbies" avoid DoCmd.RunSQL
>> and[/color]
> DoCmd.OpenQuery[color=green]
>> in the first place making the warnings a non-issue.[/color]
>
> And the "non-newbies" who do not do that use
> "DoCmd.SetWarnings False" instead of changing the SetOption
> since the latter changes a user setting, which is
> inappropriate to do without permission....
>[/color]

Michael, would you consider it appropriate for the user to alter
the state of the "Show Hidden Objects" or even worse, change the
"Default Record Locking"?

The tools->options is a jumble of user and developer switches.
AS an application's developer, I believe it's MY call as to how
the UI should behave.

But I do agree with the Docmd issues you raised.

Bob Quintal

WindAndWaves
Guest
 
Posts: n/a
#14: Nov 13 '05

re: Open Access Options without displaying database window


Hi Dixie

What I do is the following:
---------------------------------------------------------
Public Function FRUNQUE(QryN As String)
'an internal function that is used to run queries
On error GoTo err
'--------------------------------------
DoCmd.SetWarnings False
DoCmd.OpenQuery query_name, acViewNormal, acEdit
xit:
DoCmd.SetWarnings True
Exit Function
err:
''MsgBox Error$
Resume xit
End Function

---------------------------------------------------------

I have a function that I can call from anywhere, which runs a query without
any warnings

So in any other code I can write

Call frunque("MyQuery") to run myquery or any other one for that matter
without warning messages.



---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.691 / Virus Database: 452 - Release Date: 26/05/2004


Rick Brandt
Guest
 
Posts: n/a
#15: Nov 13 '05

re: Open Access Options without displaying database window


"WindAndWaves" <access@ngaru.com> wrote in message
news:5v0uc.11779$XI4.418209@news.xtra.co.nz...[color=blue]
> Hi Dixie
>
> What I do is the following:
> ---------------------------------------------------------
> Public Function FRUNQUE(QryN As String)
> 'an internal function that is used to run queries
> On error GoTo err
> '--------------------------------------
> DoCmd.SetWarnings False
> DoCmd.OpenQuery query_name, acViewNormal, acEdit
> xit:
> DoCmd.SetWarnings True
> Exit Function
> err:
> ''MsgBox Error$
> Resume xit
> End Function
>
> ---------------------------------------------------------
>
> I have a function that I can call from anywhere, which runs a query without
> any warnings
>
> So in any other code I can write
>
> Call frunque("MyQuery") to run myquery or any other one for that matter
> without warning messages.[/color]

But were you aware that you can also use...

CurrentDB.Execute "QueryName", dbFailOnError

....and you also won't get the confirmation messages?


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com




Michael \(michka\) Kaplan [MS]
Guest
 
Posts: n/a
#16: Nov 13 '05

re: Open Access Options without displaying database window


"Bob Quintal" <bquintal@generation.net> wrote...
[color=blue]
> Michael, would you consider it appropriate for the user to alter
> the state of the "Show Hidden Objects" or even worse, change the
> "Default Record Locking"?[/color]

In an app you should popbably not show the show the database window.
Otherwise if you do, and THEY show hidden objects, there is no specific
reason to hide them.

As for default record locking, if you change the settings for your db then
their default setting does not change it.
[color=blue]
> The tools->options is a jumble of user and developer switches.
> AS an application's developer, I believe it's MY call as to how
> the UI should behave.[/color]

To some extent. But its important to try to (a) not change settings you can
avoid changing, and (b) carefully set other settings back if you change them
to minimize ngative impact.


--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.


Closed Thread