Solved

Suppress Graph Datasheet Popup

Posted on 2013-01-18
15
294 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

786 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