Newbie: Passing an argument to a query, and specifying output to a ListBox 
Author Message
 Newbie: Passing an argument to a query, and specifying output to a ListBox

I am programming a simple DB in Access 2000, and I am using VB for the
controls.

I have a TextBox with a smallDate value that I want to pass to a SQL-query
when I press a search button. I also want the results from the query to be
displayed in a listbox.  I have figured out that I need to specify the query
in the VB code to be able to pass arguments from the TextBox to the query.

The code I have written for this is as follows:

Private Sub searchButton_Click()

Dim strSQL As String, dateValue As Date

    dateValue = Forms!Baseform!DateTextBox
    strSQL = "SELECT tblPicture.Image_Date, * FROM tblPicture WHERE
tblPicture.Image_Date=" & dateValue & ";"

End Sub

The problem I'm encountering is that when I press the searchButton, nothing
happens!
The query is correct, because when I run the query from within Access (by
manually entering the date condition), it displays the correct information,
so that shouldn't be the problem.

Any idas?  I would also like to get some hints on the code to return the
output from the query to a listbox.

--
_________________________
Thor Fredrik Eie



Wed, 07 Jan 2004 04:58:23 GMT  
 Newbie: Passing an argument to a query, and specifying output to a ListBox
I figured out myself :-)


Fri, 09 Jan 2004 03:26:29 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing ListBox as argument to sub

2. Newbie, correct syntax passing arguments as form names

3. Passing arguments to queries

4. Passing query name as argument in function call

5. passing arguments for queries

6. Newbie: passing argument to shell

7. how to: pass an argument to a query or sp in vb6

8. Arguments : Passing Arguments containing <">

9. Text Box Values Passed To query - newbie

10. Passing query string to another page (newbie)

11. Arguments pass short 8.3 filename, how pass LFN?

12. Passing Arguments / Passing an Array

 

 
Powered by phpBB® Forum Software