|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Hello,
I'm populating a listbox with data from an AS400 where each order I am pulling has mulitple line items. Here are my questions. 1. If I don't want to pull line items and only return each available order, is there a more efficient way than this? 'Field(0) would be the invoice number Do While Not recordset.EOF If strInvoice = recordset.Fields(0).Value Then recordset.MoveNext End If 2. Currently I am sending information to the list box like this: List1.AddItem strInvoice + " " + strName + " ... A. What is the best way to concatenate multiple vars to populate a listbox? B. Is there a way I can fixed width format them? 3. Finally, I am keeping track of which line item I am pulling from with the RecordCount. What is the ADO syntax so I can write back to that line item if I wanted to update something in it? Thanks, |
|
#2
|
||||
|
||||
|
For your first question:
The best way would be not to include those in the recordset in the first place, but I do not know how complex your query is. Programming wise though, your method is good enough. Second question: To concatonate use the & i.e. str = "some" & " " & "text" To do fixed width, you need to do two things. 1) Set the font to a fixed width type (like courier) and then use something like the Space() function to add the number of spaces that you need. For the third question: rs.EditMode then change the fields you need to update rs.Update |
|
#3
|
|||
|
|||
|
Thanks!
I was coming back to edit my question because I thought the recordset writeback might not be possible. That was only because I was thinking about SQL statements and not working with other database types. I'll give this a shot when I get a chance. After the power outage today and just getting my high-speed internet back I'm busy catching up on things. Basically your second response is the same as what I am doing since + and & are the same operator with different priorities. Although I see & used a lot more, I'd assume for readability. Thanks again, |
|
#4
|
||||
|
||||
|
As long as your open your recordset read/write and not readonly then you should be able to update it, although I typically only do updates through pure sql code myself.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > ADO Listbox population & line items? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|