I would personally use two combo boxes where the user can select the surname, once that is selected, populate the second combobox with the names, then load the datagrid.
'All your data and record source code here
RS.Open "SELECT LastName FROM tblrecords", cn, adOpenStatic, adLockOptimistic
If RS.BOF = True And RS.EOF = True Then
'whatever here
Else
Dim xCount As Integer
For xCount = 0 To RS.RecordCount -1
Combo1.AddItem RS!LastName
RS.MoveNext
Next RS
Once the user selected the surname from the combo1.Click event -
'All your data and record source code here
RS.Open "SELECT FirstName FROM tblrecords", cn, adOpenStatic, adLockOptimistic
If RS.BOF = True And RS.EOF = True Then
'whatever here
Else
Dim xCount As Integer
For xCount = 0 To RS.RecordCount -1
Combo2.AddItem RS!FirstName
RS.MoveNext
Next RS
No load your datagrid...:)
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350