Dynamically adding controls to a form

  • Thread starter Thread starter HSalim
  • Start date Start date
H

HSalim

Hello!

I doubt this is possible - I've looked everywhere and cannot seem to find an
answer.
I'm also thinking others who are far more proficient than me might have done
it if it was possible.

I am trying to modify SearchRecords2K.mdb found of www.mvps.org/access

It is neat - kudos to Dev Ashish and Terry Kreft for designing it. (I also
learned how to use a function to fill a listbox.) I have made a few minor
modifications, and added it to my application. The form builds a SQL
statement in the format
Select * from & TableName & WhereClause

The results are then displayed in a ListBox. As you know, listbox columns
are not resizable at runtime, with the result that come text columns are
getting truncated in the display. It would be ideal if I could dynamically
add columns to a subform, and display it in datasheet mode.

I thought about setting column widths programatically by running a parallel
select Max(len(Colname))
and defining the column widths of the listbox, but that still leaves a
little to be desired - so it will be my backup plan if I can't get this done

Finally, I could add a grid control - such MSFlexGrid, but i'd rather not go
that route for now.

So, suggestions, anyone?
Thanks

Habib
 
Sizing the listbox columns is possible,and not too difficult. You cannot
build forms programmatically in an MDE, which makes the datasheet option
impractical. A grid control may be your best option, if you intend to do
this in an MDE.
 
Back
Top