Avatar of Fred Fisher
Fred FisherFlag for United States of America

asked on 

Unable to get data to display on tab control pages on form

I have a form frmTitles that is all crammed into one page on a form.  I decided to use tab controls to make the form more user friendly.

I created a new form frmTitle2.  I then put the tab control on the form and created two pages Music Title Information (Page 1) and Song Information (Page 2).

I the proceeded to copy all of the controls from frmTitles onto page 1 of frmTitles2 and then the subform subfrmSongs onto page 2 of the tab control.

My problem is that when I open frmTitles2 there is no data. I have compared the Property Sheet for frmTitles and frmTitles2 and they are both the same.  All of the event procedures are there but there is no data.
Microsoft Access

Avatar of undefined
Last Comment
Fred Fisher
Avatar of Fabrice Lambert
Fabrice Lambert
Flag of France image

Can you upload your database ?
Did you check the form's data source ?
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Are you not seeing data, or are you not seeing the controls?

When you copy controls to a tab control, you must select the tab, and then click on the border which actually defines the page (at least that's the way I describe it).  Once that page is selected, you should be able to paste the copied controls inside the page.  This also applies to your subform control on the 2nd tab.

Avatar of Fred Fisher
Fred Fisher
Flag of United States of America image


I see all of the controls on the proper tab page.  The forms data source (tblTitles) is set properly and exactly the same as the original form.  In the forms Current event I have the following code which worked fine in the original form but does not seem to work in the form with the tab control.

     Dim Records As DAO.Recordset
     Dim RecordCount As Long
     Dim SRecordCount As String
     With Me
          If RecordsetClone.RecordCount > 0 Then
          End If
          !txtRecordCount = "Media Title " & .CurrentRecord & " of " & .RecordsetClone.RecordCount
     End With
     SRecordCount = DCount("[SongTitle]", "tblSongs")
     txtSongCount = SRecordCount
     txtSongCount = FormatNumber(txtSongCount, 0, , , vbTrue)
     Call SetStatusFormControls
     Call SetMediaTypeFormControls
     If Me.CurrentRecord = 1 Then
          Me.btnPreviousRecord.Enabled = False
          Me.btnFirstRecord.Enabled = False
          Me.btnPreviousRecord.Enabled = True
          Me.btnFirstRecord.Enabled = True
     End If
     If Me.CurrentRecord = Me.RecordsetClone.RecordCount Or Me.NewRecord = True Then
          Me.btnNextRecord.Enabled = False
          Me.btnLastRecord.Enabled = False
          Me.btnNextRecord.Enabled = True
          Me.btnLastRecord.Enabled = True
     End If
     Me!btnCopyRecord.Enabled = Not Me.NewRecord
     Me.btnPrintSongCard.Enabled = False

Just to be clear...have you checked that the frmTitle2 has a recordsource ?..just because you copied the controls doesn't mean they carry the recordsource they are bound
Avatar of Fred Fisher
Fred Fisher
Flag of United States of America image


Yes, the Property Sheet > Data tab is set to tblTitles.  In the code I listed the txtSongCount shows the proper count but the title count shows 1 0f 0 when it should show 1 of 1905 which put me on to thinking I was setting the RecordsetClone improperly.
Can you upload a sample database with anonymized data ?
Avatar of Fred Fisher
Fred Fisher
Flag of United States of America image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo