With a listbox, I'm pretty sure you have to do it all manually, for example:
1) Connect To Database
2) Query Database
3) Add Relevant info to listbox using the .additem method.
As far as making the listbox directly receive the recordsets.... I don't think you can.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Which, is basically what I said, without posting the code. If you are trying to bind the listbox to the database, though, that method will not work.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
One Problem that stands out, is that the lstAttach is a listbox, and NOT a textbox. A listbox has a .text property, but it's basically there just to trick you. I wrote a test program, that has only 2 lines of code on form load. Which is: list1.text = "test" and then msgbox list1.text , and you'll see the msgbox is still blank. I guess microsoft had some lazy programmers, and just decided that if a certain control doesn't logically need a certain property, to just ignore it. If you want to add the item from the listbox, you have to know which item you want to add. A listbox is almost identical to an object form of an array, in that it has indices (indexes). If you want to know which item the USER selected from the listbox, you'll need to use something like this:
rs2.AddNew
rs2.Fields(0).Value = UCase(txtID.Text)
rs2.Fields(1).Value = UCase(txtDefineTask.Text)
rs2.Fields(2).Value = UCase(txtDocuments.Text)
rs2.Fields(3).Value = DTPicker1.Value
rs2.Fields(4).Value = CInt(txtDays.Text)
rs2.Fields(5).Value = UCase(txtNotes.Text)
rs2.Fields(6).Value = lstAttach.list(lstattach.listindex)
rs2.Update
What I've done, here, is changed lstAttach.text to lstAttach.list(lstattach.listindex). If the user has not selected any item in the listbox (meaning, no item is highlighted) then you can use numbers if you know which number you want to add. For example, to add the very first item in the listbox to the database: lstAttach.list(0) . I hope this helps to clear up some of the problem.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I don't understand.....maybe you should attach the entire project. You only have 6 fields in the record (from what I can tell), so, how would you plan to add all the other stuff in the listbox? You'd need fields for those too, right? If you close in the modify portion, what do we see? UCase(lstAttach.Text), ok, it's using text again, and not list(0) or list(1) or list(list1.listindex)
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
zip it, and then attach it (you might have to click the "advanced" button below. Then I can see what you are doing, and try to follow along with your explanation of what it's SUPPOSED to be doing ;)
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215