In ACCESS 2003, I have a combox with a drop-down menu where I can select a name from a table where one of the fields is FactorName. I'm selecting a name from this field.
I have another table called FactorsCol1 which has 4 fields (including the same FactorName):
ClassName, FactorName, FactorIndex, ClassID
I want to extract a FactorIndex from this table based on information obtained after the choice in my drop down menu. Which means if I select a name say "ABC" I want to exctract the FactorIndex say "005", which is associated with this name. But here is the problem:
I use the following code:
Expand|Select|Wrap|Line Numbers
- MyVar = Me.FactorSelector1
- Debug.Print MyVar
- DoCmd.RunSQL " SELECT FactorsCol1.FactorIndex, FactorsCol1.FactorName INTO TestTable1 FROM FactorsCol1 WHERE (([FactorsCol1].[FactorName]) = ' & MyVar & ') "
Expand|Select|Wrap|Line Numbers
- DoCmd.RunSQL " SELECT FactorsCol1.FactorIndex, FactorsCol1.FactorName INTO TestTable1 FROM FactorsCol1 WHERE (([FactorsCol1].[FactorName]) = ' ABC') "