I have an unbound listbox on my main form
My subform is based on a saved query
I have a text box on the main form to save info for the criteria in the query
After the user selects which items they want from the listbox they click a cmdbutton that would take the list items selected and save them in the textbox Forms![frm_ListWellsByPad]![txt_Filter] This is used as the query criteria for the subform.
After I click the cmdbutton I cannot get the subform to requery. I get a blank set of records.
Private Sub cmd_ListWells_Click()
Dim strFltr As String
Dim itmItem
'Make sure there is something selected
If Me("lbo_PadNames").ItemsSelected.Count > 0 Then
For Each itmItem In Me("lbo_PadNames").ItemsSelected
strFltr = strFltr & Me("lbo_PadNames").ItemData(itmItem) & ","
Next
strFltr = "In (" & Left(strFltr, Len(strFltr) - 1) & ")"
End If
'The result should look like: In(7,22,1975)
Forms![frm_ListWellsByPad]![txt_Filter] = strFltr
'everything OK to here
me.requery 'doesn't work
Forms![frm_ListWellsByPad]![frm_ListWellsByPad_subform].Form.Requery 'doesn't work either
End Sub
What am I missing to make the subform use the PadName Id as it's criteria.
My subform is based on a saved query
I have a text box on the main form to save info for the criteria in the query
After the user selects which items they want from the listbox they click a cmdbutton that would take the list items selected and save them in the textbox Forms![frm_ListWellsByPad]![txt_Filter] This is used as the query criteria for the subform.
After I click the cmdbutton I cannot get the subform to requery. I get a blank set of records.
Private Sub cmd_ListWells_Click()
Dim strFltr As String
Dim itmItem
'Make sure there is something selected
If Me("lbo_PadNames").ItemsSelected.Count > 0 Then
For Each itmItem In Me("lbo_PadNames").ItemsSelected
strFltr = strFltr & Me("lbo_PadNames").ItemData(itmItem) & ","
Next
strFltr = "In (" & Left(strFltr, Len(strFltr) - 1) & ")"
End If
'The result should look like: In(7,22,1975)
Forms![frm_ListWellsByPad]![txt_Filter] = strFltr
'everything OK to here
me.requery 'doesn't work
Forms![frm_ListWellsByPad]![frm_ListWellsByPad_subform].Form.Requery 'doesn't work either
End Sub
What am I missing to make the subform use the PadName Id as it's criteria.