Expand|Select|Wrap|Line Numbers
- Private Sub PhotoSearch1_Click()
- Dim strOr As String
- Dim strDoc As String
- Dim varSelect As Variant
- Dim ctl As Control
- strDoc = "frmDescription"
- Set ctl = Forms!frmPhotoKeywordSearch.Controls("list1")
- For Each varSelect In ctl.ItemsSelected
- strOr = strOr & "[Photo Keywords] Like '*" & ctl.ItemData(varSelect) & "*' OR "
- Next varSelect
- ' lose the last ' OR '
- strOr = Left(strOr, Len(strOr) - 4)
- DoCmd.OpenForm strDoc, acNormal, , strOr
- DoCmd.Close acForm, "frmPhotoKeywordSearch"
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub PhotoSearch1_Click()
- Dim strOr As String
- Dim strDoc As String
- Dim varSelect As Variant
- Dim ctl As Control
- strDoc = "frmDescription"
- Set ctl = Forms!frmPhotoKeywordSearch.Controls("list1")
- For Each varSelect In ctl.ItemsSelected
- strOr = strOr & "[Photo Keywords] Like '*" & ctl.ItemData(varSelect) & "*' OR "
- Next varSelect
- Set ctl = Forms!frmPhotoKeywordSearch.Controls("list2")
- For Each varSelect In ctl.ItemsSelected
- strOr = strOr & "[Photo Keywords] Like '*" & ctl.ItemData(varSelect) & "*' OR "
- Next varSelect
- ' lose the last ' OR '
- strOr = Left(strOr, Len(strOr) - 4)
- DoCmd.OpenForm strDoc, acNormal, , strOr
- DoCmd.Close acForm, "frmPhotoKeywordSearch"
- End Sub
Thanks