 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 28th, 2004, 11:53 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Strsql
below is my sql and I keep getting this error "Run time error 3075" I tried everything that I know, but nothing works. HELP Please!
strsql = " SELECT tbl_Main_Quality.Analyst_Userid,tbl_Main_Quality.A ccount_Number, tbl_Main_Quality.Date_Reviewed" & _
" FROM tbl_Main_Quality " & _
" WHERE tbl_Main_Quality.Analyst_Userid='" & strtxtAnalystUserid & "'" & "AND tbl_Main_Quality.Account_Number='" & strtxtAccountNumber & "'" & "AND (" & "#" & Date & "#" & "-[Date_Reviewed)>=" & Strdate & ""
|
|

June 28th, 2004, 12:31 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
Two things I noticed:
"[Date_Reviewed)>=" should be "[Date_Reviewed])>="; you are missing the end ]
And & Strdate & "" should be & "#" & Strdate & "#"
Because you are comparing a date.
Brian
|
|

June 28th, 2004, 03:37 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
No, Brian, not quite. It looks like strDate is not a date but the DIFFERENCE between today's date and Date_Reviewed... i.e. a number.
Try this, Setyna... oh, and by the way... WELCOME!
strsql = "SELECT [Analyst_Userid], [Account_Number], [Date_Reviewed] FROM tbl_Main_Quality" & _
" WHERE [Analyst_Userid] = '" & strtxtAnalystUserid & "' AND [Account_Number] = '" & _
strtxtAccountNumber & "' AND " & DateDiff("d", Date, [Date_Reviewed]) & " >= " & Strdate
If strDate is indeed a number, you should not start it with the letters "str" because to me that means it's a string (text). If it is text then the last part should read
" >= '" & Strdate & "'"
Also, from your SQL, strDate looks like a number; but from your naming it looks like it could be a string or a date. If it's a number difference, call it something lngDaysElapsed or something like that.
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
|
|

June 28th, 2004, 03:39 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
Oh, and I never remember which date goes where in DateDiff so you may have to swap the dates to get a positive number. That is, change
DateDiff("d", Date, [Date_Reviewed])
to
DateDiff("d", [Date_Reviewed], Date)
or
Abs(DateDiff("d", Date, [Date_Reviewed]))
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
|
|

June 29th, 2004, 08:11 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks SerranoG...It's working now.yea strdate is a number..oops!
|
|
 |