Access - set RecordSource from variable? - TechRepublic
General discussion
April 5, 2001 at 01:42 AM
mrmolio

Access – set RecordSource from variable?

by mrmolio . Updated 25 years, 2 months ago

I have a drop-down combo box in a form with 10 values (say A, B, C, etc.). I would like to change the RecordSource property of the form based on what is selected from the combo box. Is this possible?

I tried storing the combo value, which match the names of the tables, to a variable (strSource), and then using the following line of code:

Me!RecordSource = “SELECT * FROM strSource”

But SQL tries to interpret the variable name literally. In other words, it can’t find a table named “strSource”.

I can do it with an IF or Select statement, but I’m just wondering if there is a way to get the SQL statement here to read from a variable.

thanks!

This discussion is locked

All Comments