views:

64

answers:

1

Okay so this is another question about a previous question I asked:

http://stackoverflow.com/questions/1435802/rookie-sql-inside-of-vb-question-msaccess-2003

I am pretty new at this so I appreciate the help guys!

So lets say I have a form and I want the SQL string in the VB to fill out a form based on parameters selected by the user on the form (combo boxes, etc) and a button click

I know how to add the parameters from the form to the SQL, but how do I get the resulting dataset to populate inside lets say a list box.

Thanks guys!

+1  A: 

Set the Row Source Type property for your list box to "Table/Query". Then you can assign your SQL statement to the list box's RowSource property.

Me.lstMyListBox.RowSource = strSQL

... where Me is a pointer to the current form, lstMyListBox is the name of your list box control, and strSQL is a variable which contains your SQL statement.

Put that in the after update event of the form control where the users input/select the parameters.

HansUp
thanks very much! this helps a lot! appreciate it...
Justin