Solved Dashboard Setting (1 Viewer)

smtazulislam

Member
Local time
Today, 11:30
Joined
Mar 27, 2020
Messages
806
Hi experts,
I have setup a dashboard, here Lebel and icon_Image to all of command in the VBA.
Also here have 5 subforms. All of subforms calculate data (any DB an analysis report).
* the problem No 1 :
When I update any data in this dB then I don't get same time update in my dashboard. If reopen dashboard then get update result.
I try : AfterUpdate event
Code:
me.requery
But nothing happen.

* the problem No 2 :
In this DB have 25+ forms. And some form have 5 to 7 tab pages.
So, I want to set command button for directly open tab page ?.
A Form details :
Form Name is frmEmployeeEdit
TabControl Name is TabGeneral
Tab Page Name is EmployeeData_Page
Button Name is lbEmployeeEdit
 

Attachments

  • 1603526630114.png
    1603526630114.png
    170.5 KB · Views: 149

June7

AWF VIP
Local time
Today, 00:30
Joined
Mar 9, 2014
Messages
5,470
Problem1: No idea why Requery fails

Problem2: You want to set focus to a particular tab page? Have you tried Me.EmployeeData_Page.SetFocus ?

If you want to provide db for analysis, follow instructions at bottom of my post.
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:30
Joined
Sep 21, 2011
Messages
14,267
Hi experts,
I have setup a dashboard, here Lebel and icon_Image to all of command in the VBA.
Also here have 5 subforms. All of subforms calculate data (any DB an analysis report).
* the problem No 1 :
When I update any data in this dB then I don't get same time update in my dashboard. If reopen dashboard then get update result.
I try : AfterUpdate event
Code:
me.requery
But nothing happen.

* the problem No 2 :
In this DB have 25+ forms. And some form have 5 to 7 tab pages.
So, I want to set command button for directly open tab page ?.
A Form details :
Form Name is frmEmployeeEdit
TabControl Name is TabGeneral
Tab Page Name is EmployeeData_Page
Button Name is lbEmployeeEdit
What afterupdate event? as the dashboard does not get updated?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:30
Joined
Feb 28, 2001
Messages
27,172
The only thing I can think of regarding the dashboard that doesn't update when you think it should, is that somehow the data on the dashboard isn't any of the things that got updated. Because otherwise, a Me.Requery ought to update something.

When I had tabs and controls on each tab, I set focus on one of the controls on the tab I wanted and that tab went to the top.
 

smtazulislam

Member
Local time
Today, 11:30
Joined
Mar 27, 2020
Messages
806
The only thing I can think of regarding the dashboard that doesn't update when you think it should, is that somehow the data on the dashboard isn't any of the things that got updated. Because otherwise, a Me.Requery ought to update something.

When I had tabs and controls on each tab, I set focus on one of the controls on the tab I wanted and that tab went to the top.
Thanks for reply.
Yes, It is. I dont know why Me.requery not display update on same time.

Problem 2 I have tried 3 method :
#1
'Me.GoToPage.EmployeeIdentity_Page.SetFocus
# 2
'Forms!frmEmployeeEdit.TabGeneral = 1
# 3
Me.EmployeeIdentity_Page.SetFocus
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:30
Joined
Feb 28, 2001
Messages
27,172
Try setting focus on a control that is on one of the pages. Not the page. A CONTROL on the page. Here, the tab change would be a side-effect of setting focus.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:30
Joined
May 7, 2009
Messages
19,234
1. use Me.Recalc to recalculate all controls.
2.
Code:
Dim pg As Page
For Each pg In Me!TabGeneral.Pages
    If pg.Name = "EmployeeData_Page" Then
        pg.SetFocus
    End If
Next
 

smtazulislam

Member
Local time
Today, 11:30
Joined
Mar 27, 2020
Messages
806
1. use Me.Recalc to recalculate all controls.
2.
Code:
Dim pg As Page
For Each pg In Me!TabGeneral.Pages
    If pg.Name = "EmployeeData_Page" Then
        pg.SetFocus
    End If
Next
Thank you so much for your reply.
problem #1
its work perfectly.

#2
its not work... give error : "Run time error 2465"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:30
Joined
May 7, 2009
Messages
19,234
is frmEmployeeEdit a subform?
if not use this sample code.
Code:
' sample code
' that opens frmEmployeeEdit
'
Private Sub commmand1_Click()
Dim frm As Form
Dim pg As Page
' open the form
DoCmd.OpenForm FormName:="frmEmployeeEdit"
' set reference to the form
Set frm = [Forms]![frmEmployeeEdit]
' loop through all Pages in TabGeneral tab control
For Each pg In frm!TabGeneral.Pages
    If pg.Name = "EmployeeData_Page" Then
        ' set focus to this page
        pg.SetFocus
    End If
Next
Set frm = Nothing
End Sub
 

smtazulislam

Member
Local time
Today, 11:30
Joined
Mar 27, 2020
Messages
806
is frmEmployeeEdit a subform?
if not use this sample code.
Code:
' sample code
' that opens frmEmployeeEdit
'
Private Sub commmand1_Click()
Dim frm As Form
Dim pg As Page
' open the form
DoCmd.OpenForm FormName:="frmEmployeeEdit"
' set reference to the form
Set frm = [Forms]![frmEmployeeEdit]
' loop through all Pages in TabGeneral tab control
For Each pg In frm!TabGeneral.Pages
    If pg.Name = "EmployeeData_Page" Then
        ' set focus to this page
        pg.SetFocus
    End If
Next
Set frm = Nothing
End Sub
Thank you so much mr. @arnelgp
It is work !
My many threads you are solved. I appreciated. Allah blessing you.
 

smtazulislam

Member
Local time
Today, 11:30
Joined
Mar 27, 2020
Messages
806
Here again have new problem...
Tab Control name is TabCtl_Menu here have 9 pages And all page is not visible . I would like to do that if I hit CmdDashboard then open Page1 [P1]& Page3 [P3]
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:30
Joined
May 7, 2009
Messages
19,234
add code to the Click event of CmdDashboard button:

Private Sub CmdDashboard_Click()
Me.P1.Visible = True
Me.P3.Visible = True
' just in case the Tab control is also not Visible.
Me.TabCtl_Menu.Visible = True
End Sub
 

smtazulislam

Member
Local time
Today, 11:30
Joined
Mar 27, 2020
Messages
806
add code to the Click event of CmdDashboard button:

Private Sub CmdDashboard_Click()
Me.P1.Visible = True
Me.P3.Visible = True
' just in case the Tab control is also not Visible.
Me.TabCtl_Menu.Visible = True
End Sub
this code I use. But it open all page.
actually, I create a Menu with SubCommand in TabControl
Tried it :
Code:
''Private Sub btnCustomers_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
''    Me.TabCtl_Menu.Visible = True
''    Me.P2.SetFocus
''    Me.P3.Visible = False
''    Me.P4.Visible = False
''    Me.P5.Visible = False
'''    Me.P1.Visible = False
''
''End Sub
''Private Sub btnProducts_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
''    Me.TabCtl_Menu.Visible = True
''    Me.P1.SetFocus
''    Me.P2.Visible = False
''    Me.P3.Visible = False
''    Me.P4.Visible = False
''    Me.P5.Visible = False
''
''End Sub

its work but Shark the submenu....
then tried it from Youtube a tutorial
Code:
'Private Function SetBtnBackClr()
Dim i As Byte
    For i = 1 To 7
        Me("btn" & i).BackColor = Box0.BackColor
    Next

    'give control color name should be RGB.Here I choise backcolor is Box1
    Me.ActiveControl.BackColor = Box9.BackColor

    Dim TabCtl_Menu As Single
    'SubMenuX = Right(Me.ActiveControl, 1)
    TabCtl_Menu = CSng(Right(Me.ActiveControl.Name, 1))    '"CSng" meanning  is ActiveControl only find (1-9) single numbers

    Me("btn" & TabCtl_Menu).SetFocus
    'Me.Label1.Caption = Me("btn" & SubMenuX).Caption

'Show the second TabCtl
'***********************************
    Dim j As Byte
    For j = 0 To TabCtl_Menu.Pages.Count - 1
        If Left(TabCtl_Menu.Pages(j).Name, 2) = Me("btn" & TabCtl_Menu).Name Then   'TabCtl_Menu page name is count (4 = Page)
            TabCtl_Menu.Pages(j).Visible = True
        Else
            TabCtl_Menu.Pages(j).Visible = False
        End If
    Next
End Function/CODE]
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:30
Joined
Feb 19, 2002
Messages
43,263
You can refer to the pages this way:

Me.TabCtlTransactions.Pages("pgIBC123").SetFocus

TabCtlTransactions - the name of the tab control.
"pgIBC123" - the name of the page
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:30
Joined
May 7, 2009
Messages
19,234
And all page is not visible
i thought you have All pages Not Visible.
you can make All Pages Not visible by going to design view and clicking on each page.
then on the property, Visible = No.
 

Users who are viewing this thread

Top Bottom