Requery for Chart on Form

L

Lee Hunter

I am attempting to use a from for two charts. The data is in two tables.
The first pass is for arrivals and the 2nd pass for departures. I have vba
code used to select the records on date. When I modify the row source and
equery for the 1st pass it works fine. When I do the same modification and
requery for the 2nd pass, I get a run time error 2118 that says, "You must
save thew current field before you can run the requery action."

I don't understand WHAT I am supposed to save and how.

Thanks for any help you can provide.

Here's the code.

Private Sub Graph0_Enter()
Dim fSource As String, MSource As String, BSource As String, Mdate As String
Mdate = InputBox("date?")
Forms!Mine!.Dateused = Mdate
fSource = "TRANSFORM Count(ArriveStat.CountDate) AS CountOfCountDate SELECT
Left([route],2) AS trip FROM ArriveStat "
MSource = "WHERE ArriveStat.CountDate = #" & Mdate & "# "
BSource = "GROUP BY Left([route],2), ArriveStat.CountDate ORDER BY
Left([route],2) PIVOT ArriveStat.Elapsed;"
Forms!Mine!Graph0.RowSource = fSource & MSource & BSource
Forms!Mine!Graph0.Requery
DoCmd.PrintOut
fSource = "TRANSFORM Count(DepartStat.CountDate) AS CountOfCountDate SELECT
Left([route],2) AS trip FROM DepartStat "
MSource = "WHERE DepartStat.CountDate = #" & Mdate & "# "
BSource = "GROUP BY Left([route],2), DepartStat.CountDate ORDER BY
Left([route],2) PIVOT DepartStat.Elapsed;"
Forms!Mine!Graph0.RowSource = fSource & MSource & BSource
Forms!Mine!Graph0.Requery
DoCmd.PrintOut
End Sub





Here's the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top