Display data in SubForm located in a Form Tab.

Posted on 2014-12-22
Last Modified: 2014-12-30
Hi Experts,
I have a Form (Form A) containing 4 Tabs.  Tab 1 is used to run Event 1 that extracts data from a series of Tables and loads the results into a Results Table.  Tabs 3 and 4 are irrelevant.

 Tab 2 contains SubForm B that is a Continuous Form- not bound to the original Form A - that is bound to the Results Table the purpose of which is to display the Results Table data.

When I click on Tab 2 after Event 1 has completed, SubForm B displays but no data is displayed.

It will display if I click a second time on Tab 2 and then Scroll my Mouse. on SubForm B.

How do I get the data to display in SubForm B when Tab 2 is clicked?

Question by:Bob_Collison
  • 4
  • 2
LVL 30

Expert Comment

ID: 40514979
Is the purpose of Tab2 sub-form B to just display the Results Table?
Upload a demo datbase to the issue.

Author Comment

ID: 40515004
The purpose is to display the results.  In addition, there is a flag field that can be changed to indicate whether or not to use each record in further processing.

I will have to extract this specific code from a very large application (55 Meg just for the code without backend DBs) to a Support DB that I can  upload.  It will take me a day or so and will complete it ASAP.

Thanks for your interest in this question.
Bob Collison.

Author Comment

ID: 40515083
The creation of the application specific elements was easier than I thought.

When the Access 2003 MDB is double clicked it automatically loads Form A.

To see the issue:
- Click the 'Criteria' Tab.
- Click the 'Select All Selection Criteria' button.
- Click the 'Initialize Data' button and watch the Message box at the bottom of the form.  It is very fast.

Click the Select Tab.  The result should be that the records created in the [00_EMAIL_EXPORT_DATA] Table in the previous steps are displayed in SubForm B on this tab.  This table is automatically emptied when the form is closed.

The User can then scroll through them and change the Y/N field at the right side to identify the addresses to be exported through the steps on the Export Tab.

Note that the Help and Export Tab functions have no impact on this issue with the records not displaying.

Bob Collison.
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

LVL 31

Accepted Solution

Helen_Feddema earned 500 total points
ID: 40521952
Just do a requery to get the data to display on the Select tab.  F9 in the interface, or Requery for an object in code.   This event procedure for the Tab control will do it (I renamed some objects with the appropriate LNC prefixes):

Private Sub tabChoices_Change()

On Error GoTo ErrorHandler

   Dim tbc As Access.TabControl
   Dim pge As Access.Page
   Dim strPage As String
   Set tbc = Me![tabChoices]
   Set pge = tbc.Pages(tbc.Value)
   strPage = pge.Name
   Select Case strPage
      Case "pgeSelect"
      Case "pgeCriteria"
         'Your code here
      Case "pgeExport"
         'Your code here
      Case "pgeHelp"
         'Your code here
   End Select
   Exit Sub

   MsgBox "Error No: " & Err.Number _
      & " in " & Me.ActiveControl.Name & " procedure; " _
      & "Description: " & Err.Description
   Resume ErrorHandlerExit

End Sub

Open in new window


Author Comment

ID: 40522274
Hi Helen,
Thanks for the solution.  Unfortunately I'm not sure what to do with it as I am not familiar with this code at all.

First within the Form Object (I assume it is Form A) where do I create this Event (tabChioices_Change)?

Secondly I assume that I need to change the Tab Control Properties > Other > Name Page Names to those in the Case Statement.  Is this correct?

Once I create the Event I don't know what to do with the various Case Statements that you have provided.  Right now most of the code is within Events at the Form A Level.  Is this correct or should some of them (like the Selection Button Code) be within the individual Tabs?

Bob Collison.

Author Comment

ID: 40522323
Hi Helen,

I was able to figure it out and it is working so you don't need to respond to my questions.
Thanks very much.
Bob Collison.
LVL 31

Expert Comment

ID: 40523883
Good -- I put in the other cases so you could put code there if needed (the code runs when a tab is clicked).  This is good for refreshing data when a change is made on another tab.

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question