A
Amanda Byrne
I have a ComboBox search in my form where you type in the Last Name and the
comboBox generates a list based on what the user types. I'd like the search
to return a list of all the items that contain the text entered, so that the
user can search by last name or by first name, and the list presented would
be ordered by last name, but don't know if this can be controlled by the SQL
statement or the AfterUpdate code or how to change the code.
(Househole table holds address, Name table holds indivdual names)
Row Source SQL statement:
SELECT Name.[Household ID], Name.[Last Name], Name.[First Name]
FROM Household INNER JOIN Name ON Household.[Household ID] = Name.[Household
ID]
ORDER BY Name.[Last Name], Name.[First Name];
AfterUpdate Code:
Private Sub ComboName_AfterUpdate()
If Not IsNull(ComboName) Then
Me.RecordsetClone.FindFirst "[Household ID] = " & Me.ComboName
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.ComboName = Null
Form.Refresh
End If
End Sub
I saw something in the forum about using stLinkCriteria, but not sure how
this fits in or works (most coding experience is from VBScript and ASPs)
Thanks! Amanda
comboBox generates a list based on what the user types. I'd like the search
to return a list of all the items that contain the text entered, so that the
user can search by last name or by first name, and the list presented would
be ordered by last name, but don't know if this can be controlled by the SQL
statement or the AfterUpdate code or how to change the code.
(Househole table holds address, Name table holds indivdual names)
Row Source SQL statement:
SELECT Name.[Household ID], Name.[Last Name], Name.[First Name]
FROM Household INNER JOIN Name ON Household.[Household ID] = Name.[Household
ID]
ORDER BY Name.[Last Name], Name.[First Name];
AfterUpdate Code:
Private Sub ComboName_AfterUpdate()
If Not IsNull(ComboName) Then
Me.RecordsetClone.FindFirst "[Household ID] = " & Me.ComboName
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.ComboName = Null
Form.Refresh
End If
End Sub
I saw something in the forum about using stLinkCriteria, but not sure how
this fits in or works (most coding experience is from VBScript and ASPs)
Thanks! Amanda