MS 2003 - SQL string inside VB question - fills in results in form?

Ok, so this is another question from the previous question I asked:

Rookie SQL inside VB question - MSAccess 2003

I'm new to this so I appreciate the help guys!

So let's say I have a form and I want a SQL string in VB to fill out the form based on the options the user has selected in the form (combo boxes, etc.) and click

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

Thanks guys!

+2


source to share


1 answer


Set the Row Source Type property to your Table / Query list. Then you can assign your SQL statement to the RowSource property of the list.

Me.lstMyListBox.RowSource = strSQL



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

Put this in an event after the form control is updated where users enter / select options.

+2


source







All Articles