J
jakub.denkiewicz
Hi i have a subform (City) within a form, and want to create a function
that selects a record on the subform using a combobox. The reason that
i created this function is that this search is used on many diffrent
subforms; therefore, i wanted to put it into a function. However, i
keep getting strange errors everytime i run this. Is it possiblet o
pass a SubForm and Combobox as parameters into a function? What am i
missing here
*****THIS DOES NOT WORK******
Function search(formBeingSearched as SubForm,comboboxBeingSearched as
Combobox)
Dim strSearch As String
strSearch = "[idString] =" & Me![comboboxBeingSearched].Column(1)
Me.formBeingSearched.Form.RecordsetClone.FindFirst (strSearch)
Me.formBeingSearched.Form.Bookmark =
Me.formBeingSearched.Form.RecordsetClone.Bookmark
End Function
Private Sub comboboxCitySearch_AfterUpdate()
Call search(subformCity, comboboxCity)
End Sub
***** THIS WORKS
Private Sub comboboxCitiesSearch_AfterUpdate()
'Find record corresponding to City Selection
Dim strSearch As String
strSearch = "[idString] =" & Me![comboboxCity].Column(1)
Me.subformCity.Form.RecordsetClone.FindFirst (strSearch)
Me.subformCity.Form.Bookmark =
Me.subformCity.Form.RecordsetClone.Bookmark
End Sub
Any help would be greatly appreciated,
Thanks.
that selects a record on the subform using a combobox. The reason that
i created this function is that this search is used on many diffrent
subforms; therefore, i wanted to put it into a function. However, i
keep getting strange errors everytime i run this. Is it possiblet o
pass a SubForm and Combobox as parameters into a function? What am i
missing here
*****THIS DOES NOT WORK******
Function search(formBeingSearched as SubForm,comboboxBeingSearched as
Combobox)
Dim strSearch As String
strSearch = "[idString] =" & Me![comboboxBeingSearched].Column(1)
Me.formBeingSearched.Form.RecordsetClone.FindFirst (strSearch)
Me.formBeingSearched.Form.Bookmark =
Me.formBeingSearched.Form.RecordsetClone.Bookmark
End Function
Private Sub comboboxCitySearch_AfterUpdate()
Call search(subformCity, comboboxCity)
End Sub
***** THIS WORKS
Private Sub comboboxCitiesSearch_AfterUpdate()
'Find record corresponding to City Selection
Dim strSearch As String
strSearch = "[idString] =" & Me![comboboxCity].Column(1)
Me.subformCity.Form.RecordsetClone.FindFirst (strSearch)
Me.subformCity.Form.Bookmark =
Me.subformCity.Form.RecordsetClone.Bookmark
End Sub
Any help would be greatly appreciated,
Thanks.