From: iris on
Hi doug,

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 very close to my
deadline... so I ask your forgiveness in advance and post my question here
hoping you will be able to help me...

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


"Doug Robbins - Word MVP" wrote:

> Try
>
> Dim i As Long
> For i = 1 To 3
> If Format(Date, "d") = i Then
> If Format(Date, "ddd") <> "Sat" And Format(Date, "ddd") <> "Sun"
> Then
> MsgBox "Today is the first working day of the month."
> Exit For
> End If
> End If
> Next i
>
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "matt" <matt(a)discussions.microsoft.com> wrote in message
> news:D11746D6-CD00-4885-8436-FB248BE160FA(a)microsoft.com...
> > Hello,
> > I want to add a conditional statement a Sub I have to do something like
> > this:
> > Psuedo Code:
> > ______________________________________________
> > If (today = first weekday of the month) Then
> > MsgBox "Today is the first weekday of the month"
> > End If
> > ______________________________________________
> >
> > I was thinking maybe using Datediff, or a Select Case. But you guys are
> > the
> > experts, open to suggestions.
> >
> >
>
>
>
From: Doug Robbins - Word MVP on
See response in the vba.Cusotmization newsgroup

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"iris" <iris(a)discussions.microsoft.com> wrote in message
news:3A8A996F-ACA0-4916-80FB-F2F5AF95D125(a)microsoft.com...
> Hi doug,
>
> 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 very close to my
> deadline... so I ask your forgiveness in advance and post my question here
> hoping you will be able to help me...
>
> 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
>
>
> "Doug Robbins - Word MVP" wrote:
>
>> Try
>>
>> Dim i As Long
>> For i = 1 To 3
>> If Format(Date, "d") = i Then
>> If Format(Date, "ddd") <> "Sat" And Format(Date, "ddd") <> "Sun"
>> Then
>> MsgBox "Today is the first working day of the month."
>> Exit For
>> End If
>> End If
>> Next i
>>
>>
>> --
>> Hope this helps.
>>
>> Please reply to the newsgroup unless you wish to avail yourself of my
>> services on a paid consulting basis.
>>
>> Doug Robbins - Word MVP
>>
>> "matt" <matt(a)discussions.microsoft.com> wrote in message
>> news:D11746D6-CD00-4885-8436-FB248BE160FA(a)microsoft.com...
>> > Hello,
>> > I want to add a conditional statement a Sub I have to do something like
>> > this:
>> > Psuedo Code:
>> > ______________________________________________
>> > If (today = first weekday of the month) Then
>> > MsgBox "Today is the first weekday of the month"
>> > End If
>> > ______________________________________________
>> >
>> > I was thinking maybe using Datediff, or a Select Case. But you guys are
>> > the
>> > experts, open to suggestions.
>> >
>> >
>>
>>
>>