I'm stumped on something that I think should be very simple. I have two combo boxes in a subform. If the user selects a particular value from the first combo box, the second one should have the same value; otherwise, they are independent.
So, on the first combo box, I've written an On Change method that looks like this:
When this runs, VB has no trouble evaluating the test expression, but it complains that I haven't specified an object on which it can make the assignment. I've rechecked the names and spellings and can't see why VB can evaluate the test expression but can't figure out what I'm referring to in the Set statement.
Here's what doesn't work:
- Variants of Me (
,
, etc.)
- Replacing [Value] with [Text] as the property being set
I'd do this with an AssignValue macro, but I don't know how to run a macro conditionally, and the assignment in SecondCombo only needs to be made for one value of FirstCombo.
Two other kinks:
1. MySubForm is synchronized with MyMasterForm not by Access's LinkMasterFields/LinkChildFields method but by Requerying the Query on which MySubForm is based as the On Click method of a list box in MyMasterForm.
2. The Query on which MySubForm is based queries a Table with Lookup list columns on the two columns are the RowSources for FirstCombo and SecondCombo. The sources of the Lookup lists are Queries of two other tables.
Sorry for these newbie questions, but I'm coming to Access from a Visual FoxPro background.
Thanks for any help,
Jim
So, on the first combo box, I've written an On Change method that looks like this:
Code:
If [Forms]![MyMasterForm]![MySubForm]_
![FirstCombo].[Value] = "Bingo" Then
Set [Forms]![MyMasterForm]![MySubForm]_
![SecondCombo].[Value] = "Bingo"
End If
When this runs, VB has no trouble evaluating the test expression, but it complains that I haven't specified an object on which it can make the assignment. I've rechecked the names and spellings and can't see why VB can evaluate the test expression but can't figure out what I'm referring to in the Set statement.
Here's what doesn't work:
- Variants of Me (
Code:
[Me]![SecondCombo].[Value]
Code:
[Me]![MySubForm]![SecondCombo].[Value]
- Replacing [Value] with [Text] as the property being set
I'd do this with an AssignValue macro, but I don't know how to run a macro conditionally, and the assignment in SecondCombo only needs to be made for one value of FirstCombo.
Two other kinks:
1. MySubForm is synchronized with MyMasterForm not by Access's LinkMasterFields/LinkChildFields method but by Requerying the Query on which MySubForm is based as the On Click method of a list box in MyMasterForm.
2. The Query on which MySubForm is based queries a Table with Lookup list columns on the two columns are the RowSources for FirstCombo and SecondCombo. The sources of the Lookup lists are Queries of two other tables.
Sorry for these newbie questions, but I'm coming to Access from a Visual FoxPro background.
Thanks for any help,
Jim