I know that this problem has been asked before, and I've been reading several solutions (some on this forum) for presenting dynamic data in a grid. I know that reassigning the RecordSource for a grid causes it to restructure itself, but I am still having no luck getting my data to display.
My datasource is a temporary table of my own creation. The SQL query that I am using to create it is working fine. I only want to display two fields from the table: the customer's name, and a quantity they have ordered. The RecordSourceType for the grid is set to zero (a table)--which I understand will be automatically opened.
I've defined the grid as a class. Here's the code that I use to run the query and reassign the recordsource for the grid.
As you can see, I've reset the grid properties that I need after the RecordSource property is set to the new table. The grid remains formatted correctly, but the data doesn't display.
Can anyone tell me what I am doing wrong? Is there something else needed? Or is this approach completely hopeless?
Thanks in advance,
Ron
My datasource is a temporary table of my own creation. The SQL query that I am using to create it is working fine. I only want to display two fields from the table: the customer's name, and a quantity they have ordered. The RecordSourceType for the grid is set to zero (a table)--which I understand will be automatically opened.
I've defined the grid as a class. Here's the code that I use to run the query and reassign the recordsource for the grid.
Code:
This.RecordSource = ""
IF !This.rmItem.Search(This.rsSO) && This executes the query
=MESSAGEBOX(This.rsSO.cMessage, 48, "Standing Orders")
ENDIF
This.RecordSource = This.rsSO.cCursorPath
This.ColumnCount = 2
This.Column1.ControlSource = "CustName"
This.Column1.Width = 306
This.Column1.ReadOnly = .T.
This.Column1.Header1.Caption = "Customer Name"
This.Column2.ControlSource = "Quantity"
This.Column2.Width = 104
This.Column2.Header1.Caption = "Quantity"
This.Refresh()
As you can see, I've reset the grid properties that I need after the RecordSource property is set to the new table. The grid remains formatted correctly, but the data doesn't display.
Can anyone tell me what I am doing wrong? Is there something else needed? Or is this approach completely hopeless?
Thanks in advance,
Ron