473,382 Members | 1,736 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,382 software developers and data experts.

Database object properties (StartupShowDBWindow)

JustJim
407 Expert 256MB
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

Expand|Select|Wrap|Line Numbers
  1. Private Sub Btn_Quit_Click()
  2. Dim NAdb As DAO.Database
  3. Set NAdb = CurrentDb
  4.  
  5. On Error GoTo Err_Btn_Quit_Click
  6.  
  7.     If Me.chkToggleState.Value = False Then
  8.         NAdb.Properties.StartUpShowDBWindow.Value = False
  9.     Else
  10.         NAdb.Properties.StartUpShowDBWindow.Value = True
  11.     End If
  12.  
  13.     DoCmd.Quit
  14.  
  15. Exit_Btn_Quit_Click:
  16.     Exit Sub
  17.  
  18. Err_Btn_Quit_Click:
  19.     MsgBox Err.Description
  20.     Resume Exit_Btn_Quit_Click
  21.  
  22. End Sub
  23.  
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
Aug 15 '07 #1
7 8308
BradHodge
166 Expert 100+
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.
Aug 15 '07 #2
FishVal
2,653 Expert 2GB
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

Expand|Select|Wrap|Line Numbers
  1. Private Sub Btn_Quit_Click()
  2. Dim NAdb As DAO.Database
  3. Set NAdb = CurrentDb
  4.  
  5. On Error GoTo Err_Btn_Quit_Click
  6.  
  7.     If Me.chkToggleState.Value = False Then
  8.         NAdb.Properties.StartUpShowDBWindow.Value = False
  9.     Else
  10.         NAdb.Properties.StartUpShowDBWindow.Value = True
  11.     End If
  12.  
  13.     DoCmd.Quit
  14.  
  15. Exit_Btn_Quit_Click:
  16.     Exit Sub
  17.  
  18. Err_Btn_Quit_Click:
  19.     MsgBox Err.Description
  20.     Resume Exit_Btn_Quit_Click
  21.  
  22. End Sub
  23.  
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 "." .
Expand|Select|Wrap|Line Numbers
  1. CurrentDB.Properties!StartupShowDBWindow.Value = ...
  2.  
Aug 15 '07 #3
JustJim
407 Expert 256MB
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
Aug 15 '07 #4
JustJim
407 Expert 256MB
Hi, Jim.

Property is a member of Properties collection. To get it you should use "!" operator instead of "." .
Expand|Select|Wrap|Line Numbers
  1. CurrentDB.Properties!StartupShowDBWindow.Value = ...
  2.  
Thank you. I knew it would be silly (of me, I'm always "banging" when I should be "dotting" and vice versa)

Jim
Aug 15 '07 #5
ADezii
8,834 Expert 8TB
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:
Expand|Select|Wrap|Line Numbers
  1. 'By Property Name (preferred)
  2. CurrentDb.Properties("StartUpShowDBWindow")
Expand|Select|Wrap|Line Numbers
  1. 'By Ordinal Position within the Collection
  2. 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!
Aug 16 '07 #6
JustJim
407 Expert 256MB
...... 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
Aug 16 '07 #7
ADezii
8,834 Expert 8TB
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.
Aug 16 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
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...
3
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...
9
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...
7
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...
10
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...
1
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...
5
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. ...
5
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...
7
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: ...
1
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
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...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...

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.