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

Listbox

Status
Not open for further replies.

Jengo

Programmer
Apr 17, 2000
100
US
How do I get the value of the first cell in a listbox, also how do I write back to that same cell?<br><br>Example:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dim tmp as string<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp = cell<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp = tmp + 2000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell = tmp
 
Ah. Similar to your first question. I think you're trying to treat a listbox as a more useful tool than it really is. I've tried a few times to do that myself, and it just ends up not being worth the time spent.<br><br>What you probably want instead is a subform. The object source for the subform should be a small form set to datasheet view that includes the columns you need. Then what you are doing is editing your data as in a regular database table, but it shows up as just part of your form. When the datasheet is set to &quot;Allowedits&quot; you can edit these &quot;cells&quot; freely in code or on the screen.<br><br>You should think of the listbox as a &quot;read only&quot; control from which your user can pick stuff. You can, in code, fetch specific columns:<br><br>listbox1.columns(1)<br><br>returns the value in the second column of the selected row. But there's no way to change it without making changes to the recordset it's based on and then requerying the rowsource. Much more efficient to use a subform, alas.<br><br>If what you need is true spreadsheet capabilities, you'll do better to insert an Excel object.<br><br>Hope this helps.<br><br>Charles<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top