wilson1001
Registered User.
- Local time
- Today, 03:59
- Joined
- Mar 24, 2003
- Messages
- 17
Hi There. I am new and very inexperienced so please forgive any daft terminology.
Using access 2002 on XP.
I have created a form with a text box that searches a table called "tapes" and a field called "agency", then displays the results in a list box. If I then click on a result it opens up the form "tapes" and should display the record I clicked on.
This is all based on Mile-o-Phile's post below.
http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=40954&highlight=complex
-What is working-
I can get the cmdsearch button to populate the list and when I click on a result it opens the correct form with a record in it.
-The problem-
unfourtunately no matter what I do, the form always displays the same record , the first in my table. It won't go to the record I click on in the results.
How can I get the selected result to open the correct record?
This is the code I am using
Private Sub cmdSearch_Click()
If IsNull(Me.txtfilter) Then
MsgBox "You have not entered any text.", vbExclamation, "Attention"
Exit Sub
End If
With LSTRESULTS
.RowSource = "Select * FROM tapes WHERE [agency]Like '*" & Me.txtfilter & "';"
.Requery
End With
End Sub
Private Sub Command54_Click()
End Sub
Private Sub lstResults_AfterUpdate()
DoCmd.OpenForm "tapes", acNormal, "[tape number]=" & LSTRESULTS.Column(0)
End Sub
I hope that's enough info.
Any helped appreciated.
Thanks
Pete
Using access 2002 on XP.
I have created a form with a text box that searches a table called "tapes" and a field called "agency", then displays the results in a list box. If I then click on a result it opens up the form "tapes" and should display the record I clicked on.
This is all based on Mile-o-Phile's post below.
http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=40954&highlight=complex
-What is working-
I can get the cmdsearch button to populate the list and when I click on a result it opens the correct form with a record in it.
-The problem-
unfourtunately no matter what I do, the form always displays the same record , the first in my table. It won't go to the record I click on in the results.
How can I get the selected result to open the correct record?
This is the code I am using
Private Sub cmdSearch_Click()
If IsNull(Me.txtfilter) Then
MsgBox "You have not entered any text.", vbExclamation, "Attention"
Exit Sub
End If
With LSTRESULTS
.RowSource = "Select * FROM tapes WHERE [agency]Like '*" & Me.txtfilter & "';"
.Requery
End With
End Sub
Private Sub Command54_Click()
End Sub
Private Sub lstResults_AfterUpdate()
DoCmd.OpenForm "tapes", acNormal, "[tape number]=" & LSTRESULTS.Column(0)
End Sub
I hope that's enough info.
Any helped appreciated.
Thanks
Pete
