?
Solved

Suppress Graph Datasheet Popup

Posted on 2013-01-18
15
Medium Priority
?
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
15 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

762 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