I don't do graphing on forms very often so here's my question.
On a form I have a button with the following code:
Code:
(on button click event)
CheckGraph
lst_ORAS.Requery
ctl_Graph.Requery
CHECKGRAPH just makes the graphing object visible if there's data to display, otherwise sets the visible property false
requeries a list box with some data in it
ctl_Graph is my graph object and it correctly updates the graph.
However, when I add this same code to my add/update button the object is visible (I can see the border) but the actual content of the graph/chart is not visible. If I tab to another form then come back to it, it is.
Has anyone encountered this and if so how do I get my form to update with the correct data as part of the larger code set? (code below)
Code:
Dim db As Database
Dim ssql As String
If fld_ORASScore < 0 Or fld_orasscore > 49 Then
MsgBox "ERROR: ORAS Score is out of acceptable range"
ElseIf IsNull(cbo_Client) Or IsNull(fld_ORASDate) Or IsNull(fld_ORASScore) Then
MsgBox "ERROR: A Court Participant, Scoring Date and Score must all be present", vbOKOnly
Else
If IsNull(lst_ORAS) Then
If DCount("*", "tbl_ORAS", "[Client_ID] = " & cbo_Client & " AND [ORAS_Date] = #" & fld_ORASDate & "#") > 0 Then
MsgBox "ERROR: ORAS Score for this date is already entered"
Else
Set db = CurrentDb
ssql = "INSERT INTO Tbl_ORAS (Client_ID, ORAS_Date, ORAS_Score) VALUES ("
ssql = ssql & cbo_Client & ", "
ssql = ssql & "#" & fld_ORASDate & "#, "
ssql = ssql & fld_ORASScore
ssql = ssql & ")"
db.Execute ssql
db.Close
ClearForm
ScoreLabel
End If
Else
If DCount("*", "tbl_ORAS", "[Client_ID] = " & cbo_Client & " AND [ORAS_Date] = #" & fld_ORASDate & "# AND ORAS_ID <> " & lst_ORAS) > 0 Then
MsgBox "ERROR: ORAS Score for this date is already entered"
Else
Set db = CurrentDb
ssql = "UPDATE Tbl_ORAS SET "
ssql = ssql & "ORAS_Date = #" & fld_ORASDate & "#, "
ssql = ssql & "ORAS_Score = " & fld_ORASScore & " "
ssql = ssql & "WHERE ORAS_ID = " & lst_ORAS
db.Execute ssql
db.Close
lst_ORAS.Requery
ClearForm
ScoreLabel
End If
End If
End If
CheckGraph
lst_ORAS.Requery
ctl_Graph.Requery
Clearform and ScoreLabel are functions that are unrelated to the graph.