Re: Run-time error'3464'

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thank you both Jerry and John for your helps, it is now working fine. I was
really puzzled because I have used my first code ( using CLng ) somewhere
else and it works fine. I just can t figure out at what condition it does not
work, the main thing is it is working now.

Many thanks.

"John Spencer" wrote:

You need to delimit date literals with the # character.

strLink = "[Due Date] Between #" & CDate(Me![Date3]) & "# AND #" &
CDate(Me![Date4]) & "#")

Another problem is if you are not in the US then you probably need to
force the date format into either the US format of m/d/y or my
preference of yyyy mm dd format.

strLink = "[Due Date] Between #" & Format(Me![Date3],"yyyy-mm-dd") & "#
AND #" & Format(Me![Date4],"yyyy-mm-dd") & "#")


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================


randria wrote:
Thanks Jerry, that got rid of the error 3464 however the query did not return
any record. Here is the correction I made based on your suggestion

strDoc = "2do"
strLink = "[Due Date] Between " & CDate(Me![Date3]) & " AND " &
CDate(Me![Date4])

I tried to put this directly in the criteria of the query: Between
([Forms]![myfrm]![Date3]) And ([Forms]![myfrm]![Date4]), using a new command
btn , the report opened with Data. I cant understand what is wrong with above
code.
Many thanks.
"Jerry Whittle" wrote:

The CLng converts them into a number so they are no longer a date. Maybe you
meant CDate.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"randria" wrote:

Hello,
I have a query based report and the following code to open the report

Private Sub Ctl2doCmd_Click()
Dim strDoc As String
Dim strLink As String

strDoc = "2do"
strLink = " [Due Date] Between " & CLng(Me![Date3]) & " AND " &
CLng(Me![Date4])

DoCmd.OpenReport strDoc, acViewPreview, , strLink

I get the above error msg (Data type mismatch ) while [Due Date],[Date3] and
[Date4] have date data type.

Please help, what am I doing wrong ?
Many thanks.


.



Relevant Pages

  • RE: Run-time error3464
    ... Thanks Jerry, that got rid of the error 3464 however the query did not return ... I tried to put this directly in the criteria of the query: ... I have a query based report and the following code to open the report ... Dim strDoc As String ...
    (microsoft.public.access.queries)
  • Re: Flying Fag Ends
    ... Jerry wrote: ... Full report here: ... Dozy mare. ... John B ...
    (uk.transport)
  • Re: Flying Fag Ends
    ... Jerry wrote: ... Full report here: ... Dozy mare. ... John B ...
    (uk.transport)
  • Re: Hilbert transform using FFT approach
    ... >Jerry Avins wrote: ... >> john wrote: ... subplot, plot, grid on, zoom on ...
    (comp.dsp)