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

How to tell if a form is opened as a tab (Access 2007)

Access 2007 optionally opens forms as tabs. There is an Access Option
that controls this - Access Options Current Database Document
Window Options Tabbed Documents.

But how, from VBA, can I programmatically tell whether or not a form
is opened in Tabbed or Overlapping mode?

I tried using

Application.GetOption("Document Window Options")

....but that is apparently an invalid name. There appears to be no form
property that indicates what mode it is opened in.

Can anyone help?

Thanks,

Peter

Mar 3 '07 #1
4 2922
On 3 Mar 2007 11:12:03 -0800, "Peter" <in**@peterssoftware.comwrote:

I don't have A2007 handy here, but in previous versions the text to
use for the various options was documented in the help file.
-Tom.

>Access 2007 optionally opens forms as tabs. There is an Access Option
that controls this - Access Options Current Database Document
Window Options Tabbed Documents.

But how, from VBA, can I programmatically tell whether or not a form
is opened in Tabbed or Overlapping mode?

I tried using

Application.GetOption("Document Window Options")

...but that is apparently an invalid name. There appears to be no form
property that indicates what mode it is opened in.

Can anyone help?

Thanks,

Peter
Mar 3 '07 #2
Thanks Tom, but I've looked through the help file and found nothing
about the Get/SetOption for Document Window Options, Overlapping
Windows, or Tabbed Documents.

Mar 3 '07 #3
On Mar 3, 11:12 am, "Peter" <i...@peterssoftware.comwrote:
Access 2007 optionally opens forms as tabs. There is an Access Option
that controls this - Access Options Current Database Document
Window Options >Tabbed Documents.

But how, from VBA, can I programmatically tell whether or not a form
is opened in Tabbed or Overlapping mode?

I tried using

Application.GetOption("Document Window Options")

...but that is apparently an invalid name. There appears to be no form
property that indicates what mode it is opened in.

Can anyone help?

Thanks,

Peter
Still looking for a solution here... Does anyone have an idea?

The help file seems to indicate that I can use

Application.GetOption("Document Window Options")

.... and it will return an integer value representing the option
selected below the "Document Window Optons" heading, but Access comes
back with the "invalid name" error.

It would be nice to know what mode (tabbed documents, or overlapping
windows) my form is opened in from VBA code.

Thanks,

Peter

Mar 5 '07 #4
Well, I've come up with this function as a work-around. A tabbed form
should be the same size as the Access window client area, so this
function checks for that:

Private Declare Function apiGetWindowRect Lib "user32" Alias
"GetWindowRect" (ByVal hWnd As Long, lpRect As sel_rect) As Long

Private Declare Function apiFindWindowEx Lib "user32" Alias
"FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String _
, ByVal lpsz2 As String) As Long
Private Function xg_IsTabbed(frm As Form) As Boolean
'* Returns True if the passed form is opened as an Access 2007 tabbed
form
'* A tabbed form will be the same size as the Access window client
area
'* Requires the GetWindowRect and FindWindowEx APIs
Dim Marker As Integer
Dim Rtn As Boolean
Dim l As Long
Dim ClientRect As sel_rect
Dim frmRect As sel_rect
Dim AccessMDIClientHwnd As Long
On Error GoTo Err_Section
Marker = 1

l = apiGetWindowRect(frm.hWnd, frmRect)
AccessMDIClientHwnd = apiFindWindowEx(Access.hWndAccessApp, 0&,
"MDIClient", vbNullString)
l = apiGetWindowRect(AccessMDIClientHwnd, ClientRect)

If frmRect.Left = ClientRect.Left _
And frmRect.Right = ClientRect.Right _
And frmRect.Top = ClientRect.Top _
And frmRect.Bottom = ClientRect.Bottom Then
'* The form size is the same size as the client area - it must
be an Access 2007 tabbed form
Rtn = True
Else
Rtn = False
End If

Exit_Section:
On Error Resume Next
xg_IsTabbed = Rtn
On Error GoTo 0
Exit Function
Err_Section:
Select Case Err
Case Else
Beep
MsgBox "Error in xg_IsTabbed (" & Marker & "), object " &
Err.Source & ": " & Err.Number & " - " & Err.Description
End Select
Err.Clear
Resume Exit_Section
End Function

Mar 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: sara | last post by:
Hi - I have been struggling with solution ideas for this now for almost 2 weeks, and have not been able to figure this out. I have a user who creates a Purchase Order (tblPOData). In some...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
3
by: simora | last post by:
Hi: Need some working sample code to post hidden form data from a php page to a new popup window. 540 x 500 centered. The popup that I'm calling already is formatted and has a TITLE:web-2007.php...
3
by: palepimp | last post by:
Hello all, I have searched far and wide for a solution to my issue. In short, here is the problem: 1. 3 PC's enter data into an Access 2003 database (PC's are running Vista w/ Office 2007...
7
by: Icarus | last post by:
I have a Access 2000 database that I am opening with Access 2007. When I open the datbase in Access 2000 or Access 2003, the database runs as expected. In Access 2007 my main form opens, a...
10
by: susan | last post by:
Hi, Is it (in Access2003) possible yo link from a form in db1 to a form in db2? Thanks, Susan
6
by: emrodge | last post by:
I'm using Access 2007 on Windows Vista and am having some problems trying to configure a simple button. There are two tables called Clients and Contacts which are linked on clients.id and...
5
by: sphinney | last post by:
Basic question: Does anyone know how to go about adding a control to an Access 2007 form that will allow viewing a Word 2007 document? Reason for asking: My office is about to receive 100+/-...
11
by: dizzydangler | last post by:
Hi, all! I'm a new user, looking to get some help on a form problem in MS Access 2007 I haven't been able to crack. I've built a form that prompts users to enter new record data, then click...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.