UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> Tab Control - Add New Tabs - Query Based, Office 2003    
 
   
fullyunknown
post Feb 25 2010, 12:23 PM
Post #1

UtterAccess Addict
Posts: 171



Ok... I was wondering if this was at all possible..

I Have a form that has a Tab COntrol on it. I had the idea of listing the days of a month that have reports due based on query.

For example, out of a month days 2, 5,8 only have reports due. So when you open the form it runs the query to see what days have a form due. Once it gets it go through and add tabs for each day. This is what I got :
CODE
Dim MyDB As DAO.Database
Dim qdef As DAO.QueryDef
x = 1
Set Db = CurrentDb
Set rs = Db.OpenRecordset("SELECT D_List.Report_Due FROM D_List GROUP BY D_List.Report_Due")
If rs.EOF = False Then
With rs
    .MoveFirst
    Do While Not .EOF

        TabCtl1.Pages.Add
        TabCtl1.Pages(x).Caption = rs!report_due
     x = x + 1
    .MoveNext
    Loop
    End With
End If
rs.Close


Well of course ran into the rpoblem that when i open the form it tells me that you can only add pages to a tab control while in design view. is there anyway around this?
Go to the top of the page
 
+
 
Start new topic
Replies
pere_de_chipstic...
post Feb 25 2010, 12:32 PM
Post #2

UtterAccess VIP
Posts: 7,580
From: South coast, England



Hi fullyunknown

No I don't believe you can add tabs except in design mode.

It is however possible to hide or unhide tabs, so if you create all the tabs you need on the design, then set each tab's visible property to 'No' then your code can then make the required tabs property visible as needed.

A maximum of 31 tabs would be needed if all the days in the month were required, but presumably you would never need reports on all 31 days and can limit the number of tabs required.

Personally I would use a method where there was a single sub form (or / on a tab), the report days would be selected in a combo box and the selection would display the appropriate data in the subform / tab

HTH
Go to the top of the page
 
+
pere_de_chipstic...
post Feb 25 2010, 12:46 PM
Post #3

UtterAccess VIP
Posts: 7,580
From: South coast, England



(IMG:style_emoticons/default/yw.gif)
Go to the top of the page
 
+

Posts in this topic


Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 08:40 PM