ComboBox Filter

  • Thread starter Thread starter Rohit Thomas
  • Start date Start date
R

Rohit Thomas

Hello All,

I have two combo boxes on a form "CmbStartDate"
and "CmbEndDate". I would like to use the result (date
range) from these controls as a filter for a report. I am
trying to use the following code below but there's seems
to be something wrong with my syntax. Can anyone point out
the mistake and correct it...I been working on this for
hours with disappointing results.

Thanks in advance,
Rohit Thomas

stLinkCriteria = stLinkCriteria & _
" [FileDate] = Between #" & _
CDate(Me.CmbStartDate) & "# And #" & _
CDate(Me.CmbEndDate) & "#"

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
 
take the = sign out of the expression.
" [FileDate] Between #" & _
CDate(Me.CmbStartDate) & "# And #" & _
CDate(Me.CmbEndDate) & "#"

if that doesn't work, try
" [FileDate] >= #" & _
CDate(Me.CmbStartDate) & "# And [FileDate] <= #" & _
CDate(Me.CmbEndDate) & "#"

also, if CmbStartDate and CmbEndDate are in a standard date format (such as
4/29/04), i don't think you'll need the CDate() function.

hth


Rohit Thomas said:
Hello All,

I have two combo boxes on a form "CmbStartDate"
and "CmbEndDate". I would like to use the result (date
range) from these controls as a filter for a report. I am
trying to use the following code below but there's seems
to be something wrong with my syntax. Can anyone point out
the mistake and correct it...I been working on this for
hours with disappointing results.

Thanks in advance,
Rohit Thomas

stLinkCriteria = stLinkCriteria & _
" [FileDate] = Between #" & _
CDate(Me.CmbStartDate) & "# And #" & _
CDate(Me.CmbEndDate) & "#"

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
 
Thanks Tina for you help....that did the trick.

Rohit
-----Original Message-----
take the = sign out of the expression.
" [FileDate] Between #" & _
CDate(Me.CmbStartDate) & "# And #" & _
CDate(Me.CmbEndDate) & "#"

if that doesn't work, try
" [FileDate] >= #" & _
CDate(Me.CmbStartDate) & "# And [FileDate] <= #" & _
CDate(Me.CmbEndDate) & "#"

also, if CmbStartDate and CmbEndDate are in a standard date format (such as
4/29/04), i don't think you'll need the CDate() function.

hth


Hello All,

I have two combo boxes on a form "CmbStartDate"
and "CmbEndDate". I would like to use the result (date
range) from these controls as a filter for a report. I am
trying to use the following code below but there's seems
to be something wrong with my syntax. Can anyone point out
the mistake and correct it...I been working on this for
hours with disappointing results.

Thanks in advance,
Rohit Thomas

stLinkCriteria = stLinkCriteria & _
" [FileDate] = Between #" & _
CDate(Me.CmbStartDate) & "# And #" & _
CDate(Me.CmbEndDate) & "#"

DoCmd.OpenReport stDocName, acViewPreview, ,
stLinkCriteria


.
 
Back
Top