In my application, users can toggle the Database Window using a toggle button on a form - no problems here. When the application is closed and re-opened the startup properties take effect but the state of the toggle button used above doesn't change. So I want to look at the state of the toggle button (actually a Boolean field in the underlying table which reflects the state of the togglebutton) and set the startup property StartupShowDBWindow appropriately.
I tried this - Private Sub Btn_Quit_Click()
-
Dim NAdb As DAO.Database
-
Set NAdb = CurrentDb
-
-
On Error GoTo Err_Btn_Quit_Click
-
-
If Me.chkToggleState.Value = False Then
-
NAdb.Properties.StartUpShowDBWindow.Value = False
-
Else
-
NAdb.Properties.StartUpShowDBWindow.Value = True
-
End If
-
-
DoCmd.Quit
-
-
Exit_Btn_Quit_Click:
-
Exit Sub
-
-
Err_Btn_Quit_Click:
-
MsgBox Err.Description
-
Resume Exit_Btn_Quit_Click
-
-
End Sub
-
but get a "Method not found" error with the StartupShowDBWindow highlighted.
The property has been set and unset from <Tools> <Startup> Display database window and the application restarted so I shouldn't have to create the property.
Probably something silly but it's escaping me.
Thanks in advance
Jim
7 8308
In my application, users can toggle the Database Window using a toggle button on a form - no problems here. When the application is closed and re-opened the startup properties take effect but the state of the toggle button used above doesn't change. So I want to look at the state of the toggle button (actually a Boolean field in the underlying table which reflects the state of the togglebutton) and set the startup property StartupShowDBWindow appropriately.
Just a suggestion Jim, but why not set the toggle button back to false on Quit (or on close of your main form). That way, you always know where it is going to be when the database opens and you don't have to check it's state.
Brad.
In my application, users can toggle the Database Window using a toggle button on a form - no problems here. When the application is closed and re-opened the startup properties take effect but the state of the toggle button used above doesn't change. So I want to look at the state of the toggle button (actually a Boolean field in the underlying table which reflects the state of the togglebutton) and set the startup property StartupShowDBWindow appropriately.
I tried this - Private Sub Btn_Quit_Click()
-
Dim NAdb As DAO.Database
-
Set NAdb = CurrentDb
-
-
On Error GoTo Err_Btn_Quit_Click
-
-
If Me.chkToggleState.Value = False Then
-
NAdb.Properties.StartUpShowDBWindow.Value = False
-
Else
-
NAdb.Properties.StartUpShowDBWindow.Value = True
-
End If
-
-
DoCmd.Quit
-
-
Exit_Btn_Quit_Click:
-
Exit Sub
-
-
Err_Btn_Quit_Click:
-
MsgBox Err.Description
-
Resume Exit_Btn_Quit_Click
-
-
End Sub
-
but get a "Method not found" error with the StartupShowDBWindow highlighted.
The property has been set and unset from <Tools> <Startup> Display database window and the application restarted so I shouldn't have to create the property.
Probably something silly but it's escaping me.
Thanks in advance
Jim
Hi, Jim.
Property is a member of Properties collection. To get it you should use "!" operator instead of "." . -
CurrentDB.Properties!StartupShowDBWindow.Value = ...
-
Just a suggestion Jim, but why not set the toggle button back to false on Quit (or on close of your main form). That way, you always know where it is going to be when the database opens and you don't have to check it's state.
Brad.
Hmm worth a think. I'm going to have to change all my exit buttons to link them to one form so that I can do an "application on close" event. May just take your advice if there is no other specific help forthcoming.
Thanks
Jim
Hi, Jim.
Property is a member of Properties collection. To get it you should use "!" operator instead of "." . -
CurrentDB.Properties!StartupShowDBWindow.Value = ...
-
Thank you. I knew it would be silly (of me, I'm always "banging" when I should be "dotting" and vice versa)
Jim
Thank you. I knew it would be silly (of me, I'm always "banging" when I should be "dotting" and vice versa)
Jim
There are basically 2 acceptable Method to Set/Retrieve Dynamic Properties contained within a Properties Collection: - 'By Property Name (preferred)
-
CurrentDb.Properties("StartUpShowDBWindow")
- 'By Ordinal Position within the Collection
-
CurrentDb.Properties(25).Name
NOTE: Although the Bang Operator will yield the same results and also save you a bit of typing, you'll pay for it with a speed penalty. Behind the scenes, the Bang Reference is translated to the Parentheses-and-Quotes format for referring to an Item within a Collection. The usual recommendation is to always use the later format for referring to a Member of a Collection unless it is absolutely necessary to use the Bang Operator. One place the Bang Operator is necessary is Query Parameters that refer to Form Fields as in: Forms!FormName!ControlName. In virtually all other instances avoid the Bang and stay with Quotes!
...... In virtually all other instances avoid the Bang and stay with Quotes!
Thank you for that. A major problem with being self-taught is that you don't get these basics stuck in your head properly.
Had a laugh at the exclamation mark/point (bang) at the end of your advice to avoid the suckers though.
Jim
Thank you for that. A major problem with being self-taught is that you don't get these basics stuck in your head properly.
Had a laugh at the exclamation mark/point (bang) at the end of your advice to avoid the suckers though.
Jim
It's critical that you maintain your sense of humor in this business, because things can get a littly 'dry' at times. Take care.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ImraneA |
last post by:
Hi there
Many thanks to those people who contributed to this group, helped me
greatly.
Enclose, my code, hope it helps others :-
Public Function Export_Excel_9(tbx1 As Variant, tbx2 As...
|
by: Daniel M |
last post by:
I'm building a medium-scale data-entry web application, which involves
creating data entry forms, record listings and detail screens for lots of
database tables.
Rather than designing a series...
|
by: Nathan Sokalski |
last post by:
I am trying to connect to a Microsoft Access Database from my ASP.NET
Application. I use the following code to create my connection string:
cmdSelect.Connection = New...
|
by: vsiat |
last post by:
I am trying to create a treeview out of a database table
with the typical structure ID, NAME, PARENTID, TYPE,
EXTRA_INFO, where is linked to the .
What I want to achieve is create a tree made...
|
by: jt |
last post by:
The program works like this:
There is a form with a button.
When the form is loaded, a separate thread is started which is
retreiving/updating data in the database every x seconds.
When clicked...
|
by: |
last post by:
Hi. This is a a semi-newbie question about how to store arbitrary
information about my apps
such that I can code quickly, mimizing complexity and the number of things I
have to hold in my brain. I...
|
by: Tarscher |
last post by:
Hi all,
My application uses a database to store big blobs (0.5 - 1 Gb). I have
a List of a class Sample that I store in a blob. Since the blob can
become very big I want to use compression.
...
|
by: Gav |
last post by:
I'm writing a windows application (using C# VS 2005 Pro) to access a MS SQL
database and although it is working fine (up to now) I'm not sure I'm going
about it in the best way. Can anybody point...
|
by: Jim Devenish |
last post by:
I wish to control which users can and cannot alter the toolbars. The
opening popup window invites them to login. Immediately after this, I
have the code:
...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |