|
 |
asp_databases thread: Re: SV: Select Statement
Message #1 by Martin Lee <access@o...> on Mon, 15 Apr 2002 22:39:00 +0800
|
|
Thanks.
Martin
At 10:32 4/15/2002 +0200, you wrote:
>WHERE DepositDate BETWEEN strMonth & ".01." & strYear & " 00:00:01" And
>strNextMonth & ".01." & strNextYear & " 00:00:01"
>Or
>WHERE DepositDate >= strMonth & ".01." & strYear & " 00:00:01" And
>DepositDate < strNextMonth & ".01." & strNextYear & " 00:00:01"
>
>
>' find value of strNexsMonth and strNextYear...
>If strMonth = 12 Then
> strNextMonth = 1
> strNexsYear = strYear + 1
>Else
> strNewsMonth = strMonth + 1
> strNexsYear = strYear
>End If
>
>
>
>
>/Martin
>
>-----Oprindelig meddelelse-----
>Fra: Martin Lee [mailto:access@o...]
>Sendt: 15. april 2002 10:03
>Til: ASP Databases
>Emne: [asp_databases] Select Statement
>
>
>
>Am trying to set up a form which would allow users to view records from a
>specific month and year. There are two combo boxes on the form: cboMonth
>(January to December) and cboYear(2000 to current year).
>
>Any pointers on the Where part of the SQL statement to only retrieve
>records from selected month and year?
>
>strMonth = Request.Form("cboMonth")
>strYear = Request.Form("cboYear")
>
>SQL = "Select * From tblDeposit Where DepositDate =" 'Am stuck here:)
>
>Thanks,
>
>Martin
>
>
>
Message #2 by Martin Lee <access@o...> on Mon, 15 Apr 2002 22:39:57 +0800
|
|
Thanks Kim, will work on this.
Martin
At 10:18 4/15/2002 +0200, you wrote:
>It depends on which database you're using, but try with year(depositdate)
>" & strYear & " AND month(depositdate) = " & strMonth & "
>
>your month will have to be a number (not a string).
>
>-Kim
>
>-----Oprindelig meddelelse-----
>Fra: Martin Lee [mailto:access@o...]
>Sendt: 15. april 2002 10:03
>Til: ASP Databases
>Emne: [asp_databases] Select Statement
>
>
>
>Am trying to set up a form which would allow users to view records from a
>specific month and year. There are two combo boxes on the form: cboMonth
>(January to December) and cboYear(2000 to current year).
>
>Any pointers on the Where part of the SQL statement to only retrieve
>records from selected month and year?
>
>strMonth = Request.Form("cboMonth")
>strYear = Request.Form("cboYear")
>
>SQL = "Select * From tblDeposit Where DepositDate =" 'Am stuck here:)
>
>Thanks,
>
>Martin
>
>
>
>
Message #3 by =?iso-8859-1?Q?Martin_N=2E_S=F8rensen?= <mns@w...> on Mon, 15 Apr 2002 10:32:39 +0200
|
|
WHERE DepositDate BETWEEN strMonth & ".01." & strYear & " 00:00:01" And
strNextMonth & ".01." & strNextYear & " 00:00:01"
Or
WHERE DepositDate >=3D strMonth & ".01." & strYear & " 00:00:01" And
DepositDate < strNextMonth & ".01." & strNextYear & " 00:00:01"
' find value of strNexsMonth and strNextYear...
If strMonth =3D 12 Then
strNextMonth =3D 1
strNexsYear =3D strYear + 1
Else
strNewsMonth =3D strMonth + 1
strNexsYear =3D strYear
End If
/Martin
-----Oprindelig meddelelse-----
Fra: Martin Lee [mailto:access@o...]
Sendt: 15. april 2002 10:03
Til: ASP Databases
Emne: [asp_databases] Select Statement
Am trying to set up a form which would allow users to view records from
a
specific month and year. There are two combo boxes on the form: cboMonth
(January to December) and cboYear(2000 to current year).
Any pointers on the Where part of the SQL statement to only retrieve
records from selected month and year?
strMonth =3D Request.Form("cboMonth")
strYear =3D Request.Form("cboYear")
SQL =3D "Select * From tblDeposit Where DepositDate =3D" 'Am stuck
here:)
Thanks,
Martin
Message #4 by "Kim Iwan Hansen" <kimiwan@k...> on Mon, 15 Apr 2002 10:18:37 +0200
|
|
It depends on which database you're using, but try with year(depositdate)
" & strYear & " AND month(depositdate) = " & strMonth & "
your month will have to be a number (not a string).
-Kim
-----Oprindelig meddelelse-----
Fra: Martin Lee [mailto:access@o...]
Sendt: 15. april 2002 10:03
Til: ASP Databases
Emne: [asp_databases] Select Statement
Am trying to set up a form which would allow users to view records from a
specific month and year. There are two combo boxes on the form: cboMonth
(January to December) and cboYear(2000 to current year).
Any pointers on the Where part of the SQL statement to only retrieve
records from selected month and year?
strMonth = Request.Form("cboMonth")
strYear = Request.Form("cboYear")
SQL = "Select * From tblDeposit Where DepositDate =" 'Am stuck here:)
Thanks,
Martin
|
|
 |