hello
i have a search facility on my form and currently it works, with some code i found from the net.
the search works where you enter the BuildingID in an unbound textbox 'SearchBuildID' and click on the search command button cmdSearch, it will bring up the corresponding record.
i've also added two other unbound textboxes to the form header - SearchAddress and SearchLine (one to search the Address1, 2 & 3 fields and another to search the Line field). These have not been coded yet as I would like the one Search button to be able to do the searches.
At the moment I have the following code.
=====================================================================
Private Sub cmdSearch_Click()
' Dim strSearch As String
'---------------------------------------------------------------
'Performs the search using value entered into SearchBuildID
'and evaluates this against values in BuildingID
DoCmd.ShowAllRecords
DoCmd.GoToControl ("BuildingID")
DoCmd.FindRecord Me!SearchBuildID
BuildingID.SetFocus
SearchBuildID = BuildingID.Text
SearchBuildID.SetFocus
strSearch = SearchBuildID.Text
End Sub
=====================================================================
as you can see the code works, but isn't coded properly (all my fault).
if anyone could help.
thanks!
i have a search facility on my form and currently it works, with some code i found from the net.
the search works where you enter the BuildingID in an unbound textbox 'SearchBuildID' and click on the search command button cmdSearch, it will bring up the corresponding record.
i've also added two other unbound textboxes to the form header - SearchAddress and SearchLine (one to search the Address1, 2 & 3 fields and another to search the Line field). These have not been coded yet as I would like the one Search button to be able to do the searches.
At the moment I have the following code.
=====================================================================
Private Sub cmdSearch_Click()
' Dim strSearch As String
'---------------------------------------------------------------
'Performs the search using value entered into SearchBuildID
'and evaluates this against values in BuildingID
DoCmd.ShowAllRecords
DoCmd.GoToControl ("BuildingID")
DoCmd.FindRecord Me!SearchBuildID
BuildingID.SetFocus
SearchBuildID = BuildingID.Text
SearchBuildID.SetFocus
strSearch = SearchBuildID.Text
End Sub
=====================================================================
as you can see the code works, but isn't coded properly (all my fault).
if anyone could help.
thanks!