views:

118

answers:

1

Just some general formatting questions about return records to a list box on a form:

I have a list box that returns sets of records based on SQL statement in VB. I need the SQl statement to return the ID (auto number) of each record, because if the user selects from this list box, I need the ID as a pass parameter to the next form. But I do not need the ID to show up in the actual list....anyway i can hide this, or just not display it?

I used rowsource like this:

me.searchlist.rowsource = "SELECT TblMain.MainID, TblMain.First, TblMain.MiddleTblMain.Last FROM TblMain ORDER BY TblMain.Last, TblMain.First DESC;"

Also the listbox has no headers, which i want, and has three columns for above example...but each column is way too big, can i control the width size of each column area inside the listbox? I tried the properties window, but that only seems to effect the first column and not all of them.

Thanks!

+3  A: 
  • For the Header, the Listbox has a property called Column Heads (default no). Set this to Yes.
  • For the column widths, the Listbox has a property for Column Count and Column Widths. In your case you can set Column Count to 3 and Column Widths to something like 0;2;3
astander
not quit what I was looking for, but this will work. Thanks!
Justin
That might not be what you were looking for but that's the recommnded and only solution.
Tony Toews
@Justin: just curious why you don't like the answer. It's the way Access is built. If you're bringing expectations from a different programming environment that's *your* problem, don't you think?
David-W-Fenton