Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get grid to display data...

Status
Not open for further replies.

rlawrence

Programmer
Sep 14, 2000
182
US
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.


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
 
This.RecordSource = This.rsSO.cCursorPath should be sufficient to display records, as long as it is a valid record source.
Maybe it isn't getting evaluated properly. Check the value of 'This.rsSO.cCursorPath' at runtime. Try adding () around it or add qoutes if there are any spaces in the pathname.

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Hi Dave,

Thanks for responding. Your suggestion has helped a lot--though I took a roundabout way and experienced a lot of very bizarre behaviors to confirm it. Wow! This control seems really fragile!

Thanks again,

Ron

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top