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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox show 2 of 3 columns!

Status
Not open for further replies.

Judi201

Technical User
Jul 2, 2005
315
US
Hi!

I have a listbox using the code below. Only the first two values show. I created the listbox visually, set columncount to 3. I'm trying to use example from '1001 Things....'

Code:
LOCAL lcJobsnumb, lcRowsource
lcJobsnumb = Thisform.pgfCasting.pagJobs.txtJobsnumb.Value

*!*	SELECT Typebad.badno,Btypes.typedesc, 
*!* SUM(Typebad.badqty) AS scrap ;
*!*	FROM  casting!typebad LEFT OUTER JOIN casting!btypes ;
*!*	ON  Typebad.badno = Btypes.badno ;
*!*	WHERE ALLTRIM(typebad.jobsnumb) = lcJobsnumb ;
*!*	ORDER BY Typebad.jobsnumb, Typebad.badno ;
*!*	GROUP BY Typebad.badno INTO CURSOR csrtemp

lcRowSource = 'SELECT Typebad.badno,Btypes.typedesc, SUM(Typebad.badqty) as scrap '
lcRowSource = lcRowSource + 'FROM  casting!typebad LEFT OUTER JOIN casting!btypes ' 
lcRowSource = lcRowSource + 'ON  Typebad.badno = Btypes.badno '
lcRowSource = lcRowSource + 'WHERE alltrim(typebad.jobsnumb) = lcJobsnumb '
lcRowSource = lcRowSource + 'ORDER BY Typebad.jobsnumb, Typebad.badno '
lcRowSource = lcRowSource +  'GROUP BY Typebad.badno INTO CURSOR csrtemp'


WITH Thisform.pgfCasting.pagJobs.lstBadType
	.RowSourceType = 3
	.RowSource =lcRowSource
	.Requery()
	.ListIndex = 1
ENDWITH
Thisform.Refresh()

The commented code above gives the correct 3 values, but I only get the first 2 in the listbox. I made sure the width of box was adequate and tried it with and without setting column widths.

Still on VFP 6.0 but moving to 9 next week [bigsmile]and I'm sure many, many questions will follow.

Any suggestions appreciated.

Judi
 
Try this modification this to the last bit of code

WITH Thisform.pgfCasting.pagJobs.lstBadType
.ColumnCount = 3
.RowSourceType = 3
.RowSource =lcRowSource
.Requery()
.ListIndex = 1
ENDWITH

Regards,

Rob
 
Rob,
Thanks for the response, but that did not help. Any other thoughts?

Judi
 
Try setting the column widths and have you verified the query returns data in all 3 rows?


Regards,

Rob
 
lcRowSource = 'SELECT Typebad.badno,ALLTRIM(Btypes.typedesc) AS typedesc, SUM(Typebad.badqty) as scrap '

You likely have to much width so alltrim and change width of listbox.


Regards,

Rob
 
Rob,
I appreciate your response; but, as I said in my post, I verified that the commented code returns the three values correctly and I have varied the column width to test that.

Judi
 
Have you tried expanding the listbox width beyond its current limit to the full length of the screen to make sure you are seeing beyond the limited visible area you now have? Have you tried creating a test form with a list box to isolate any bugs in your form/listbox?

Regards,

Rob
 
Hi!

Just to close this thread, I found that using TRAMSFORM() with the numeric field scrap causes it to show in the listbox. I had read about date fields, but thought numeric was ok. I don't understand but will leave it at that. Maybe 9.0 will be different!

Judi
 
Oh well,

Once I understand what I need to do, it ceases to be a problem anyway. [smile]

Judi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top