Hello Greg,
I know this is not a question about this specific post and I already posted
the question as a new post... but I'm desperate... and still did't fined an
answer to my problem... I don't know if I declare the variable right... or
the problem is in the SQL query... PLEASE HELP!!!
I have an access table called: "categories"
this table contains all the documents I have created with their delivery date.
in "categories" I have created 2 columns: "delivery_date", "subject"
I have created a userform in WORD with the following fields:
textbox - Txt_start_date
textbox - Txt_end_date
listbox - listbox1
search button
When I press the "search" button I want to start a search that will upload
to the list box all the documents between Txt_start_date and Txt_end_date.
this is the code I wrote... which, unfortunatly doe's not work:
Private Sub searchdate_Click()
On Error Resume Next
Dim dbDatabase As Database
Dim rsi As Recordset
Dim i As Integer
Set dbDatabase = OpenDatabase("C:\masterfood.mdb")
Set rsi = dbDatabase.OpenRecordset("SELECT * FROM categories WHERE
delivery_date BETWEEN '" & Txt_start_date.Text & "' AND '" &
Txt_start_date.Text & "' order BY delivery_date;", dbOpenSnapshot)
i = 0
ListBox1.Clear
With rsi
Do Until .EOF
ListBox1.AddItem (i)
ListBox1.ColumnCount = 9
ListBox1.BoundColumn = 9
ListBox1.ColumnWidths = "3.5 in;0 in;0.7 in;1.5 in;1.5 in;0.7 in;0.7
in;0.7 in;0.7 in;"
ListBox1.Column(9, i) = ![remarks]
ListBox1.Column(8, i) = ![sender_l_name]
ListBox1.Column(7, i) = ![sender_f_name]
ListBox1.Column(6, i) = ![l_name]
ListBox1.Column(5, i) = ![f_name]
ListBox1.Column(4, i) = ![tafkid]
ListBox1.Column(3, i) = ![irgun]
ListBox1.Column(2, i) = ![delivery_date]
ListBox1.Column(1, i) = ![Path]
ListBox1.Column(0, i) = ![Subject]
.MoveNext
i = i + 1
Loop
End With
rsi.Close
dbDatabase.Close
Set rsi = Nothing
Set dbDatabase = Nothing
End Sub
I hope you can help me with that...
Thank you in advance!
Iris