ctroyp
IS-IT--Management
- Oct 7, 2003
- 60
Hello,
I am fairly new to Access and I am trying to find a way to print results from a query into a listbox on a form. I actually have it working, but how can I modify it to keep the "Enter Parameter Value" dialog box from popping up? I am reading a text entry from the first textbox, appending it to the query, and setting the query to the rowsource after clicking the "Search" button.
Here is the code for the button click event:
-----------------------
Option Compare Database
Private Sub cmdSearch_Click()
On Error Resume Next
Dim sSQL As String
'Start the SQL statement.
sSQL = "SELECT Customers.CompanyName FROM Customers WHERE Customers.CompanyName = Me.txtSQL.Value;"
'Assign the query to the results listbox.
Me.lstResults.RowSource = sSQL
End Sub
-----------------------
Thanks in advance...
I am fairly new to Access and I am trying to find a way to print results from a query into a listbox on a form. I actually have it working, but how can I modify it to keep the "Enter Parameter Value" dialog box from popping up? I am reading a text entry from the first textbox, appending it to the query, and setting the query to the rowsource after clicking the "Search" button.
Here is the code for the button click event:
-----------------------
Option Compare Database
Private Sub cmdSearch_Click()
On Error Resume Next
Dim sSQL As String
'Start the SQL statement.
sSQL = "SELECT Customers.CompanyName FROM Customers WHERE Customers.CompanyName = Me.txtSQL.Value;"
'Assign the query to the results listbox.
Me.lstResults.RowSource = sSQL
End Sub
-----------------------
Thanks in advance...