[AccessD] JIT Forms

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Thu Nov 8 19:19:00 CST 2007


Aha. That's what I was looking for. Change event.  Too bad there isn't a
GotFocus or Activate event for each page.  But this will work.   I can do a
Select Case on the page and load the controls for that page in the case for
each tab.  That will work!

Thanks

Rocky
 




 	
	

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren D
Sent: Thursday, November 08, 2007 3:37 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] JIT Forms

Hi Rocky

Not so sure about JC's cool JIT logic

But there is an OnChange event for Tabs - Way cool very powerful and easy to
manipulate

See below for some Code snips below I am using for a 10 Tab Form

Now it is a snip so some of it may not work correctly etc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Private Sub tabMain_Change()

On Err GoTo Err_tabMain_Change

Dim intClientID As Integer

intClientID = Me.tabMain

Dim tbc As Control
Dim pg As Page
Dim ctl As Control

Dim db As DAO.Database
Dim selSQL As String
Dim rs As DAO.Recordset

Set tbc = Me!tabMain
Set pg = tbc.Pages(tbc.Value) 'Current page

Set db = CurrentDb
selSQL = "SELECT tblClients.ClientID, tblClients.ClientName,
tblClients.DatabaseName, tblClients.ClientAbbrev, tblClients.IsCurrent,
tblClients.IsNowDeleted FROM tblClients WHERE (((tblClients.IsCurrent)=-1)
AND
((tblClients.IsNowDeleted) Is Null Or (tblClients.IsNowDeleted)=0));"

Set rs = db.OpenRecordset(selSQL)

'reset things to true or false if true may exist for more thant 1 tab

If pg.Name = "pgOptions" Then ' Option Page - Don't show everything for the
clients - Show the setup options only
            Forms!xfrmBeast!subfrmOptions.SourceObject =
"sub_frmBeastOptions"
            Forms!xfrmBeast!subfrmLocalOptions.SourceObject =
"sub_frmLocalOptions"

            Me.subfrmMain.Visible = False
            Me.tabOptions.Visible = True
            Me.subfrmNotes.Visible = False
            Me.subfrmContacts.Visible = False
            Me.tabSupport.Visible = False
            
            'Determine what controls get seen or used
	For Each ctl In Me.Controls
                If ctl.Tag <> "" Then
                    ctl.Enabled = False
                End If
            Next
        
	ElseIf Me("pg" & Me.tabMain).Caption = "Active" Then
        
        ElseIf Me("pg" & Me.tabMain).Caption = "SomeText" Then
            Me.cmdBFM.Enabled = False
        Else
   
            For Each ctl In Me.Controls
                 If ctl.Tag <> "" Then
                    ctl.Enabled = True
                End If
            Next
            
            Me.tabOptions.Visible = False
            
        End If

Me.subfrmMain.Requery
Me.subfrmNotes.Requery
Me.subfrmContacts.Requery

Me.txtClientID = Forms!xfrmBeast.tabMain

txtInvoiceSearch = ""
txtAccountNo = ""

If intClientID = 0 Then
    Me.subfrmContacts.Form.lblAdviceContacts.Caption = "General Contacts"
    Me.subfrmNotes.Form.lblAdviceNotes.Caption = "General Notes"
    Me.lblMain.Caption = "Options and Settings"
    txtInvoiceSearch.Enabled = False
    txtAccountNo.Enabled = False
ElseIf intClientID = 1 Then
    Me.subfrmContacts.Form.lblAdviceContacts.Caption = "Active Contacts"
    Me.subfrmNotes.Form.lblAdviceNotes.Caption = "Active Info"
    Me.lblMain.Caption = "Details about...us"
    txtInvoiceSearch.Enabled = False
    txtAccountNo.Enabled = False
ElseIf intClientID = 2 Then
    Me.subfrmContacts.Form.lblAdviceContacts.Caption = "Contacts for Client:
" & Me("pg" & intClientID).Caption
    Me.subfrmNotes.Form.lblAdviceNotes.Caption = "Notes For Client: " &
Me("pg"
& intClientID).Caption
    Me.lblMain.Caption = "Bureau Details for: " & Me("pg" &
intClientID).Caption
    txtInvoiceSearch.Enabled = True
    txtAccountNo.Enabled = True
ElseIf intClientID > 1 Then
    Me.subfrmContacts.Form.lblAdviceContacts.Caption = "Contacts for Client:
" & Me("pg" & intClientID).Caption
    Me.subfrmNotes.Form.lblAdviceNotes.Caption = "Notes For Client: " &
Me("pg"
& intClientID).Caption
    Me.lblMain.Caption = "Bureau Details for: " & Me("pg" &
intClientID).Caption
    txtInvoiceSearch.Enabled = True
    txtAccountNo.Enabled = True
End If

rs.Close
db.Close

Set rs = Nothing
Set db = Nothing

Exit_tabMain_Change:
Exit Sub

Err_tabMain_Change:

MsgBox Err.Number & " " & Err.Description, vbCritical, "Error in tbMain
Change"
Resume Exit_tabMain_Change

End Sub
































Many thanks
 
Have a great day
 
Darren
-----------------
T: 1300 301 731
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Friday, 9 November 2007 9:32 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] JIT Forms

JC:
 
I have a form with about 16 tabs, a bunch of combo boxes, and a bunch of
sub-forms.  It will not surprise you to learn that it is taking an
unacceptably long time to open - 60 seconds on a smallish database over a
wireless connection to my laptop (trying to simulate a slow server).
 
I remember something about a form like this that you had and, I believe,
loading the combo boxes and sub forms only when a tab got the focus?  The
combo boxes are bound so I can't wait to put in the row source until they're
clicked.  But I could load the row source when the tab was activated - store
the row source in the tag and load it if it's not there.  But there's no
activate or got focus event for a tab.  There is a mouse move event but I'm
not sure that will do  to trigger loading of the Row Source and the
sub-forms. 
 
How did you solve the problem?

Regards,
 
Rocky
 

 	
	
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.15.24/1117 - Release Date: 11/7/2007
10:52 PM
 




More information about the AccessD mailing list