wilson1001
Registered User.
- Local time
- Today, 06:50
- 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 need some help with a form I have created to search a table.
I have created a search form with a text box and command button that search a table called "tapes" and a field called “agency”. It then displays the results in a listbox.
If a result is selected it opens a form called “tapes” and should display the corresponding record.
My form is based on the post by Mile-o-Phile - http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=40954&highlight=complex
-What Works-
I can enter text into the text box, hit the command button and the listbox will be populated with results.
If I click then on a result, it will open the correct form.
-My Problem-
Although the correct form is opened the record displayed is always the same, the first in my table. It will not display the record that corresponds to the result I clicked on.
-The code-
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
Any help would be appreciated
Thanks
Pete

Using access 2002 on XP.
I need some help with a form I have created to search a table.
I have created a search form with a text box and command button that search a table called "tapes" and a field called “agency”. It then displays the results in a listbox.
If a result is selected it opens a form called “tapes” and should display the corresponding record.
My form is based on the post by Mile-o-Phile - http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=40954&highlight=complex
-What Works-
I can enter text into the text box, hit the command button and the listbox will be populated with results.
If I click then on a result, it will open the correct form.
-My Problem-
Although the correct form is opened the record displayed is always the same, the first in my table. It will not display the record that corresponds to the result I clicked on.
-The code-
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
Any help would be appreciated
Thanks
Pete
