Brahim Djouadi
asked on
FindFirst on list box
I am using the FindFirst method and for each record found,
I have a list that's contain a id, first name and last name.
on click on the list it take the same id in the edit box for id
I take an action.
It's seem, When i have the same name it take the first name .
How can i solve this problem ?
I have a list that's contain a id, first name and last name.
on click on the list it take the same id in the edit box for id
I take an action.
It's seem, When i have the same name it take the first name .
How can i solve this problem ?
Private Sub list0_Click()
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[Name]='" & list0.Column(0) & "' And [LastName]='" & list0.Column(1) & "'"
If rst.NoMatch Then
MsgBox "There is No Name"
End If
If Not rst.EOF Then
Me.Bookmark = rst.Bookmark
End If
End Sub
ASKER
Thank you Gustav Brock
the field [Name] mean the first name
how can i solve my problem to take the next name
i'm new in acces
the field [Name] mean the first name
how can i solve my problem to take the next name
i'm new in acces
Well, you can move to the next:
If Not rst.EOF Then
rst.MoveNext
If Not rst.EOF Then
Me.Bookmark = rst.Bookmark
End If
End If
ASKER
the same problem
MoveNext does nothing
if i have two same names
on click on the list the edit boxes that contain id,firstname and the lastname value it take the same value for the first id,firstname and the lastname
It's seem, When i have the same name and last name it take the first record .
MoveNext does nothing
if i have two same names
on click on the list the edit boxes that contain id,firstname and the lastname value it take the same value for the first id,firstname and the lastname
It's seem, When i have the same name and last name it take the first record .
If you search for something (a combination of fields/values) that is unique, it will find that entry. Otherwise, it will find the first match.
That's by design.
That's by design.
ASKER
are there any type to find a solution to do this
example
if i have 5 names like this:
========================
id - firstname - lastname
1 jhon helen
2 adam gebson
3 jhon helen
4 admin master
5 jhon helen
========================
and i have edit box with query for search on event on change
when i search for that name jhon
it will show the three names
and on click on one of them they take the same id
witch mean it only take the first
how can i make it when i click on any name give me it's id
example
if i have 5 names like this:
========================
id - firstname - lastname
1 jhon helen
2 adam gebson
3 jhon helen
4 admin master
5 jhon helen
========================
and i have edit box with query for search on event on change
when i search for that name jhon
it will show the three names
and on click on one of them they take the same id
witch mean it only take the first
how can i make it when i click on any name give me it's id
Yes. Use the first field, ID, as the bound column of the listbox.
That will make ID the selected value, and that is unique.
That will make ID the selected value, and that is unique.
ASKER
how can i do that ?
because i think FindFirst accept only strings
i have attached my file can you do that
and thank you
example.mdb
because i think FindFirst accept only strings
i have attached my file can you do that
and thank you
example.mdb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
All Done
Include FirstName in the search to find individual names.