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!

formatting a listbox and have problems... 1

Status
Not open for further replies.

DBServices

Programmer
Aug 19, 2010
54
US
Basically what I want to do is format a list box to look like this:

BACON BRKFST PLATTER
----Egg OE
----Grits
----White Toast

3 FRENCH TOAST ON SOUR DOUGH

NEW YORK STRIP & EGGS
----NY Strip MR
----Eggs OE
----English Muffin
----Grits

Here is the code I have so far, but the AddItem is not adding it the way I want it to look...Any Ideas??? Thanks

Code:
  Do While Not rsItems.EOF
  ordSelection = rsItems.Fields(0)
    itemID = rsItems!MenuItemID
    itemName = rsItems!MenuItemName
    lst.AddItem (itemID & ";" & UCase(itemName))
    strSQL2 = "SELECT * FROM qryMenuItemDetails where OrderSelection = " & ordSelection
    Set rsSubItems = CurrentDb.OpenRecordset(strSQL2, dbOpenForwardOnly)
    
    Do While Not rsSubItems.EOF
      subItemID = rsSubItems!MenuItemDetailsID
      subItemName = rsSubItems!MenuItemChoiceDescription
       If Not IsNull(rsSubItems!PrepName) Then subItemPrep = rsSubItems!PrepName
      lst.AddItem (subItemID & ";" & "-----" & subItemName & ";" & subItemPrep)
      rsSubItems.MoveNext
    Loop
rsItems.MoveNext
  Loop
End Sub
 
DBService said:
not adding it the way I want it to look...Any Ideas???
We have trouble seeing your results. Have you attempted to set a breakpoint and step through your code?

How many columns? How about column widths? What happens if you replace the ";" with ":"?

Duane
Hook'D on Access
MS Access MVP
 
Your advice worked...I set the column widths in code but they were set in the property box as well and were different...Stepped through and now it works like a charm...Thank you for your help, I really appreciate it! Amazing how something so simple can be sooooo frustrating!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top