Hi..First off, no worries about any delays, I get busy too! Besides I've had time to play round and learn a bit more about what I'm trying to do.
P.S. The code you've posted is supposed to do exactly what you are getting (each time executed it replaces subform RowSource with a new query returning one recipe name).
The easiest way to do multiple selection is to update Y/N field in tblRecipes you've mentioned in msg#1.
I came to that conclusion last night after trying it with the listbox on multi-select, and using the ItemsSelected property. I got this to work, but when I changed categories in the combobox then clicked on a recipename the previous selections would disappear from the subform. What I have now appears to work (so far)...
Here are my relevant table structures:
tblRecipes:
-RecipeID - AutoNumber (PK)
-RecipeName - Text
-FoodCategory - Text (FK to tblFoodCategories.FoodCategory)
-Source - Text
-Instructions - Memo
-Selected - Y/N
tblFoodCategories:
-FoodCategory - Text (PK)
And my current form design etc:
Main form
-FoodCategory (ComboBox with RowSource = SELECT tblFoodCategories.FoodCategory FROM tblFoodCategories;)
- Private Sub FoodCategory_AfterUpdate()
-
-
If IsNull(Me!FoodCategory) Then
-
Me!Subfrm1.Form.RecordSource = ""
-
Else
-
Me!Subfrm1.Form.RecordSource = "SELECT * FROM tblRecipes WHERE tblRecipes.FoodCategory ='" & Me!FoodCategory & "'"
-
End If
-
Me.Requery
-
End Sub
-
-Subfrm1 (Continuous form)
--RecipeName - TextBox - ControlSource = RecipeName
--CheckSelected - Checkbox - ControlSource = Selected
- Private Sub CheckSelected_Click()
-
Me.Parent.SubfrmSelected.Form.RecordSource = "SELECT * FROM tblRecipes WHERE tblRecipes.Selected = -1;"
-
Me.Parent.SubfrmSelected.Requery
-
End Sub
-SubfrmSelected (Datasheet Form)
--RecipeName - TextBox - ControlSource = RecipeName
--FoodCategory - TextBox - ControlSource = FoodCategory
Thank you for your help in getting this far, hope its clear what I have so far, and sorry for the long post!
Jenny