Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Multi-Selct List Box to Filter subform

Status
Not open for further replies.

sterlecki

Technical User
Oct 25, 2003
181
0
0
US
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.
 
how about:

me.frm_ListWellsByPad_subform.Requery

that is assuming frm_ListWellsByPad_subform is the anme of the subform CONTROL

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
KenReay,

That didn't seem to do it. Just so we're clear the Name of the subform is: frm_ListWellsByPad_subform

The source object of the subform is: Query.qry_data_DrillOutWells_by_Pads

I only put a subform window in the form and used my saved query as the source object as opposed to building a subform and placing this into the mainform. Maybe that's the difference.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top