Full Version: Row source does not exist
UtterAccess Forums > Microsoft® Access > Access Forms
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 .
I'm getting an error message:
"Row 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.
I've tried this but it doesn't work....
CODE

Dim db As Database
Dim q As QueryDef
Dim qry_Cht As String
Dim strMySQL As String
.
Set db = CurrentDb
.
Me.Detail.Visible = False
.
qry_Cht = "qry_GraphData"
If IsQueryInDatabase(qry_Cht) Then
    Me.Graph100.Visible = True
Else
    Set q = db.CreateQueryDef(qry_Cht)
    Me.Graph100.RowSource = " "
    Me.Graph100.Visible = False
End If
.
Set db = Nothing
jwhite
Sounds like the query is your RecordSource? If so, then it must exist on open of the form. You could create a "template" Query that would return no data or a default data set). Call it qry_GraphData_Template, and copy it to qry_GraphData. On close of the form, copy qry_GraphData_Template to qry_GraphData, effectively resetting the used query to the template query.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.