Jonathan Kok
Registered User.
- Local time
- Today, 13:37
- Joined
- Jan 27, 2000
- Messages
- 116
Hey, all, been a while since I last posted, good to see this board's still up!
First, a pic of what I want to work:
OK, so here's the problem. I've got a table that contains ten fields per record that I need to chart in a line graph as a subform on a form. Since I can't do it using a standard line graph, I've got to take those ten fields, throw them into a temporary table, and requery the chart. So, no prob, I do that, here's the code for that:
Voila, table created. I then make the subform visible, and requery the data.
OK, it works, the FIRST time. I've got it set up so that it erases the data from the temporary table as soon as the button that makes the table loses focus (LostFocus), and renders the subform invisible again.
Now, the problem. When I click on the 'cmdBuildSHChart' button again, it repopulates the table, but dies on the Requery code (Error '2118', You must save the current field before you run the Requery action). OK, so what's going on? What field is it talking about? As you can see, I added the 'saverecord' command to the code PRIOR to creating the table, so what field is it referring to?
Any help would be appreciated. Or, an alternative solution would be great! Thanks!
EDIT: add picture
[This message has been edited by Jonathan Kok (edited 02-13-2002).]
First, a pic of what I want to work:
OK, so here's the problem. I've got a table that contains ten fields per record that I need to chart in a line graph as a subform on a form. Since I can't do it using a standard line graph, I've got to take those ten fields, throw them into a temporary table, and requery the chart. So, no prob, I do that, here's the code for that:
Code:
Private Sub cmdMakeSHChart_Click()
Dim db
Dim SHList
Set db = CurrentDb
Set SHList = db.openrecordset("tempSHChart")
DoCmd.RunCommand acCmdSaveRecord
If Not IsNull(coHV05) And coHV05 <> "" Then
With SHList
.AddNew
!tSHHVName = "HV 0.5"
!tSHHVValue = coHV05
.Update
End With
End If
If Not IsNull(coHV1) And coHV1 <> "" Then
With SHList
.AddNew
!tSHHVName = "HV 1"
!tSHHVValue = coHV1
.Update
End With
End If
.
.
. (this continues on for 10 fields)
.
Code:
sbfSHChart.Visible = True
sbfSHChart!SHChart.Requery
End Sub
OK, it works, the FIRST time. I've got it set up so that it erases the data from the temporary table as soon as the button that makes the table loses focus (LostFocus), and renders the subform invisible again.
Now, the problem. When I click on the 'cmdBuildSHChart' button again, it repopulates the table, but dies on the Requery code (Error '2118', You must save the current field before you run the Requery action). OK, so what's going on? What field is it talking about? As you can see, I added the 'saverecord' command to the code PRIOR to creating the table, so what field is it referring to?
Any help would be appreciated. Or, an alternative solution would be great! Thanks!
EDIT: add picture
[This message has been edited by Jonathan Kok (edited 02-13-2002).]