Full Version: Record source 'GraphData' specified on this form doesn't exist
UtterAccess Forums > Microsoft® Access > Access Forms
ToyotaSupra88
I'm getting an error message:
"Record source 'qry_GraphData' specified on this form does not exist." plus "An error occurred while sending data to OLE ..." etc.
I have this form with a graph / chart Embedded - the query and the data doesn't exist on OPEN of the form - not until the user runs a switch/button to actviate a couple of commands to create the query... which should update the graph.
CODE

Private Sub Form_Open
.
.
Dim db As Database
Dim qry_Cht As String
.
Set db = CurrentDb
.
qry_Cht = "qry_GraphData"
If IsQueryInDatabase(qry_Cht) Then
     Beep
Else
    Me.Graph100.Visible = False
End If
.
Set db = Nothing
.
GroverParkGeorge
If the query doesn't exist when the form opens, Access surely can't find the query, so this does make sense. Therefore, it would seem to me that the solution is NOT to use the query as the form's Record source until after it has been created by your code.

In other words, don't bind the form to a record source, but set the form's record source in the code, right after the query is created:
CODE
'Code to create the query here....
e.Recordsource = "qry_GraphData"



On the Unload event for the form, you'll need to remove the recordsource so it is unbound when it opens again.

CODE
Private Sub Form_Unload(Cancel As Integer)
Me.RecordSource = ""
End Sub


However, this also begs the question: Once the query is created and used as the recordsource for this form, do you delete it again?



Edited by: GroverParkGeorge on Tue Sep 2 22:25:16 EDT 2008.
ToyotaSupra88
My StartUp Form has a couple of buttons to create tables and queries from imported data... and once it's gotten to one of it's many steps - it creates a query for a bar graph / chart that is at the bottom of the form. The problem the form is having, "On Open" the query is not there for the graph .
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.