I am new to access and have found extensive help on this forum from previous posts so thank you all for unknowingly assisting!
I cannot find the answer to this on the forum so far, please point me in the right direction if I have missed something...
I have a form (frmMasterPeople) which contains buttons (e.g. add new person) and a subform datasheet (frmPeopleList). When a user doubleclicks a line in the datasheet it takes them to that record in a new form window.
I want to create a search box in the main form which filters the datasheet (frmPeopleList). I have managed to create this which searches based on the contacts full name.
Code I have used is:
However I want this to be able to show results based on all of the fields in the datasheet.
The datasheet is based on a table (tblPeople)
The fields in view in the datasheet are labelled:
p_full_name
p_role
p_tel
Therefore if I was to search for the term "camp" I might recieve people who have the surname Campbell as well as people with the role campaign manager.
Any ideas if this is possible? As the database already contains some sensitive data I would prefer not to upload it if possible.
I cannot find the answer to this on the forum so far, please point me in the right direction if I have missed something...
I have a form (frmMasterPeople) which contains buttons (e.g. add new person) and a subform datasheet (frmPeopleList). When a user doubleclicks a line in the datasheet it takes them to that record in a new form window.
I want to create a search box in the main form which filters the datasheet (frmPeopleList). I have managed to create this which searches based on the contacts full name.
Code I have used is:
Code:
Private Sub cmdSearch_Click()
Forms!frmmasterpeople!txtSearch.SetFocus
If Len(Trim(txtSearch.Text)) = 0 Then
frmPeopleList.Form.FilterOn = False
Exit Sub
End If
Dim Text As String
Text = "[p_role] LIKE '*" & Trim$(txtSearch.Text) & "*'"
frmPeopleList.Form.Filter = Text
frmPeopleList.Form.FilterOn = True
However I want this to be able to show results based on all of the fields in the datasheet.
The datasheet is based on a table (tblPeople)
The fields in view in the datasheet are labelled:
p_full_name
p_role
p_tel
Therefore if I was to search for the term "camp" I might recieve people who have the surname Campbell as well as people with the role campaign manager.
Any ideas if this is possible? As the database already contains some sensitive data I would prefer not to upload it if possible.