Solved

Suppress Graph Datasheet Popup

Posted on 2013-01-18
15
293 Views
Last Modified: 2013-01-20
Hello Experts,

I am updating a graph on a form from data entered in a text box.

It is being updated dynamically by requerying in the gotfocus  event.

Problem is that when its being updated the the datasheet pops up and i don' want the end user to see it.

Is there a way tu suppress it?

Thanks
0
Comment
Question by:SweetingA
  • 9
  • 6
15 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 38794727
0
 

Author Comment

by:SweetingA
ID: 38794910
Not really sure what you have done exactly as the graph does not show up at all.

I modified the one from yesterday a little - see attached.

When you change the result you will see the problem i have (datasheet annoyingly pops up)

the reason i am playing around with the format a little is because the message box is in an annoying place and when i enter yes i also get the focus stuck in the subform and i can't find any way to position the message box unless i make my own which seems a little stupid.

Regards
TargetTrackingREV.mdb
0
 

Author Comment

by:SweetingA
ID: 38796999
Hi Capricorn 1,

Could you also explain why you set the rowrource equal to itself?

Not sure what that is aiming to do.

Thanks
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38797052
that is another way of (forcing) a requery of the graph.
0
 

Author Comment

by:SweetingA
ID: 38797069
i see but the graph no longer shows without clickin on it and off it again?
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38797100
see if the Activate property of the graph is set on focus
0
 

Author Comment

by:SweetingA
ID: 38797138
The auto activate is set on getfocus but you commented out the requery in the on focus event , was that intentional?
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38797154
yes
0
 

Author Comment

by:SweetingA
ID: 38797166
Hi Capricorn1,

I think there are now two issues with the script

1. the graph does not automatically display (white square)
2. when i force the graph to dispaly and update the result on the form, the subform updates but the graph does not refresh

previously...

1. the graph used to display automatically
2. the graph updated when the result was changed but the graphs datasheet displyed which was increbibly annoying

Thanks for your patience
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38797728
sweetingA,
i  don't know what to say, it is working perfectly ok here, using  windows 7 ultimate, tested in A2007 and A2010
0
 

Author Comment

by:SweetingA
ID: 38798858
Hi Capricorn1,

I have tested it on another computer with XP and A2007.

Graph now displays but when i update the result the graph does still not update until i leave the record and re-enter the record.

Regards
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38798892
you may need to save the record first

try adding

me.dirty=false 'add this line
me.graph1.setfocus

me.graph1.rowsource=me.graph1.rowsource
0
 

Author Comment

by:SweetingA
ID: 38798980
the test system i normally use is windows 7 and A2003 which highlights both issues
0
 

Author Comment

by:SweetingA
ID: 38798998
Hi Capricorn1,

The atatched code now works but only 1 very small annoyance.

Whe i update results, the datasheet for the graph flashes on the sceen for a moment while its being updated and then dissappears as i shift the focus.

I will award the points anyway for all your help but is there any chance to stop it flashing on the screen?

Thanks

Option Compare Database

Private Sub Command42_Click()
'Form_frm_PDM_Targets.DataEntry = True
Forms!frm_PDM_Targets.DataEntry = True
End Sub

Private Sub Form_Load()
On Error GoTo Err_NewRecord_Click

DoCmd.GoToRecord , , acLast
DoCmd.GoToRecord , , acNext
Me.Year.SetFocus
Me.frm_PDM_Results_subform.Visible = False
Me.SubformLabel.Visible = False
Me.Graph1.Visible = False

Exit_NewRecord_Click:
    Exit Sub

Err_NewRecord_Click:
    MsgBox Err.Description
    Resume Exit_NewRecord_Click
End Sub

Private Sub Form_Current()
    Me.Measure.Requery
    Me.Unit.Requery
    Me.[Sort Criteria] = Me.Year & Me.Period & Me.Measure
    Me.[Sort Criteria 2] = Me.Year & Me.Measure
    Me.[Sort Criteria 3] = Me.Year - 1 & Me.Period & Me.Measure
End Sub

Private Sub Year_AfterUpdate()
    If IsNull(Year) Then
        MsgBox ("Enter Year")
        Me.Period.Locked = True
        Me.Year.SetFocus
    Else:
        Me.Period.Locked = False
    End If
End Sub

Private Sub Period_AfterUpdate()
    If IsNull(Period) Then
        MsgBox ("Enter Period")
        Me.Project_Category.Locked = True
        Me.Period.SetFocus
    Else:
        Me.Project_Category.Locked = False
    End If
End Sub

Private Sub Project_Category_AfterUpdate()
    Me.Measure.Requery
    If IsNull(Project_Category) Then
        MsgBox ("Enter Project_Category")
        Me.Measure.Locked = True
        Me.Project_Category.SetFocus
    Else:
        Me.Measure.Locked = False
    End If
End Sub

Private Sub Measure_AfterUpdate()
    Dim a As String
    Dim b As String
    Dim c As String
    Dim d As String
    Dim e As String
    Me.Unit.Requery
    Me.[Sort Criteria] = Me.Year & Me.Period & Me.Measure
    Me.[Sort Criteria 2] = Me.Year & Me.Measure
    Me.[Sort Criteria 3] = Me.Year - 1 & Me.Period & Me.Measure
    a = DLookup("[Unit]", "tbl_PDM_TargetProjects", "[Measure]=Forms!frm_PDM_Results.Measure")
    b = DCount("[Sort Criteria]", "tbl_PDM_Results", "[Sort Criteria] = Forms!frm_PDM_Results.[Sort Criteria]")
    c = DCount("[Result]", "tbl_PDM_Results", "[Sort Criteria]=Forms!frm_PDM_Results.[Sort Criteria 3]")
    If c >= 1 Then
        d = DLookup("[Result]", "tbl_PDM_Results", "[Sort Criteria]=Forms!frm_PDM_Results.[Sort Criteria 3]")
        Me.PYR = d
        strSQL = "UPDATE tbl_PDM_Results" & " SET tbl_PDM_Results.[Previous Year Result] = " & d & " WHERE [Sort Criteria] = Forms!frm_PDM_Results.[Sort Criteria 3]"
        With DoCmd
            .SetWarnings False
            .RunSQL strSQL
            .SetWarnings True
        End With
    End If
    If b = 0 Then
        If IsNull(Measure) Then
            MsgBox ("Enter Measure")
            Me.Result.Locked = True
            Me.Measure.SetFocus
        Else:
            Me.Unit = a
            Me.Result.Locked = False
            CurrentDb.Execute "delete * from tbl_PDM_Results WHERE [Result] is NULL"
            Me.frm_PDM_Results_subform.Visible = True
            Me.SubformLabel.Visible = True
            Me.Graph1.Visible = True
        End If
    Else:
        e = MsgBox("Record exists, do you want to update an existing record?", vbYesNo + vbQuestion, "Important Message!")
        If e = vbNo Then
            Me.Year = Null
            Me.Period = Null
            Me.Project_Category = Null
            Me.Measure = Null
            Me.Unit = Null
            Me.Sort_Criteria = Null
            Me.[Sort Criteria] = Null
            Me.[Sort Criteria 2] = Null
            Me.[Sort Criteria 3] = Null
            Me.Year.SetFocus
        ElseIf (e = vbYes) Then
            With Me.RecordsetClone
            .FindFirst "[Sort Criteria]='" & Me.[Sort Criteria] & "'"
            If Not .NoMatch Then
                Me.Bookmark = .Bookmark
            Else
                MsgBox "Record not found"
            End If
            End With
            CurrentDb.Execute "delete * from tbl_PDM_Results WHERE [Result] is NULL"
            Me.frm_PDM_Results_subform.Visible = True
            Me.SubformLabel.Visible = True
            Me.Graph1.Visible = True
            Me.Graph1.SetFocus
            Me.Graph1.RowSource = Me.Graph1.RowSource
            Me.Result.SetFocus
        End If
    End If
    Me.Result.SetFocus
    Call LeftClick
End Sub

Private Sub Result_AfterUpdate()
    Me.Dirty = False
    Me.Graph1.SetFocus
    Me.Graph1.RowSource = Me.Graph1.RowSource
    Me.Dirty = False
    Me.Year.SetFocus
End Sub

Private Sub Form_Close()
On Error GoTo Err_Exit_Click

CurrentDb.Execute "delete * from tbl_PDM_Results WHERE [Result] is NULL"

Exit_Exit_Click:
    Exit Sub

Err_Exit_Click:
    MsgBox Err.Description
    Resume Exit_Exit_Click
End Sub
0
 

Author Closing Comment

by:SweetingA
ID: 38799578
I will add a seperate question about the datasheet flashing up on the screen during updated
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now