Wrox Programmer Forums
|
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
 
Old June 28th, 2004, 11:53 AM
Registered User
 
Join Date: Jun 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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 & ""



 
Old June 28th, 2004, 12:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
 
Old June 28th, 2004, 03:37 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

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
 
Old June 28th, 2004, 03:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

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
 
Old June 29th, 2004, 08:11 AM
Registered User
 
Join Date: Jun 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks SerranoG...It's working now.yea strdate is a number..oops!






Similar Threads
Thread Thread Starter Forum Replies Last Post
response.write strSQL shows no values! ronny Classic ASP Databases 3 December 13th, 2007 01:50 PM
Chapter 2 strSQL statement tomyeager BOOK: Beginning VB.NET Databases 4 September 22nd, 2007 10:16 AM
Strange Error inh STRSQL alirezaaali Classic ASP Databases 1 August 5th, 2007 11:56 AM
strSQL syntax Christiane Giguere Classic ASP Databases 2 January 25th, 2005 11:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.