Author |
Topic |
Alfred
Senior Member
USA
1527 Posts |
Posted - 17 October 2003 : 22:50:34
|
But laser, as I said, I just downloaded the data from my server, so it is identical. |
Alfred The Battle Group CREDO
|
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 17 October 2003 : 23:57:37
|
OK, you've lost me ... |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 18 October 2003 : 00:53:28
|
How so? To make sure that I have identical data on my server and on localhost I downloaded the Access database file from the server to localhost. |
Alfred The Battle Group CREDO
|
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 18 October 2003 : 01:03:50
|
I can't figure out what you mean in your 17 October 2003 : 21:03:18 post. It sounds like you've got something out of sync somewhere - whether it be code or data. That's why I suggested using Table Editor, so you can confirm what's on the server without the upload/download all the time. |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 18 October 2003 : 12:44:39
|
That may have been the trouble with the serverr yesterday, because it reports properly in time sync now. Look how nicely it reports: http://www.ggholiday.com/bg/forums/DEFAULT.ASP
quote: I discovered another error though: Posted - 16 October 2003 : 21:04:18 -------------------------------------------------------------------------------- You might want to do the following incase you clear out a games VICTOR value or the below will look for null or blank
strSql = "SELECT * FROM Games WHERE Start_Date > #" & DateAdd("d",-2,Now()) & "# and isNUll(VICTOR) or VICTOR=''" set LateNews = my_Conn.Execute(strSql)
Since the "or" has priority, the above would select all games without a victor, regardless of date. So I added the red part: quote: strSql = "SELECT * FROM Games WHERE Start_Date > #" & DateAdd("d",-2,Now()) & "# and isNUll(VICTOR) or Start_Date > #" & DateAdd("d",-2,Now()) & "# and VICTOR=''" set LateNews = my_Conn.Execute(strSql)
Many thanks for all suggestions!
|
Alfred The Battle Group CREDO
|
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 18 October 2003 : 18:13:44
|
A better way would be :
strSql = "SELECT * FROM Games WHERE Start_Date > #" & DateAdd("d",-2,Now()) & "# and (isNUll(VICTOR) or VICTOR='')"
You are defining your own precedence using this method.
|
|
|
Alfred
Senior Member
USA
1527 Posts |
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 18 October 2003 : 23:15:07
|
When I tried to collect data from the forum_members table to see see new members of the last 30 days, writing: quote: strSql = "SELECT COUNT(MEMBER_ID) AS NAME_COUNT FROM FORUM_MEMBERS WHERE M_SINCE > #" & DateAdd("d",-30,Now()) & "#"
it returned nothing. Checking, I found the M_DATE to be a text field. Is there a way to translate the data in that field so it can be used as date for my purpose? |
Alfred The Battle Group CREDO
|
Edited by - Alfred on 19 October 2003 17:21:33 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 19 October 2003 : 18:25:08
|
I found the code: quote: function StrToDate(strDateTime) if ChkDateFormat(strDateTime) then 'Testing for server format if strComp(Month("04/05/2002"),"4") = 0 then StrToDate = cdate("" & Mid(strDateTime, 5,2) & "/" & Mid(strDateTime, 7,2) & "/" & Mid(strDateTime, 1,4) & " " & Mid(strDateTime, 9,2) & ":" & Mid(strDateTime, 11,2) & ":" & Mid(strDateTime, 13,2) & "") else StrToDate = cdate("" & Mid(strDateTime, 7,2) & "/" & Mid(strDateTime, 5,2) & "/" & Mid(strDateTime, 1,4) & " " & Mid(strDateTime, 9,2) & ":" & Mid(strDateTime, 11,2) & ":" & Mid(strDateTime, 13,2) & "") end if else if strComp(Month("04/05/2002"),"4") = 0 then tmpDate = DatePart("m",strForumTimeAdjust) & "/" & DatePart("d",strForumTimeAdjust) & "/" & DatePart("yyyy",strForumTimeAdjust) & " " & DatePart("h",strForumTimeAdjust) & ":" & DatePart("n",strForumTimeAdjust) & ":" & DatePart("s",strForumTimeAdjust) else tmpDate = DatePart("d",strForumTimeAdjust) & "/" & DatePart("m",strForumTimeAdjust) & "/" & DatePart("yyyy",strForumTimeAdjust) & " " & DatePart("h",strForumTimeAdjust) & ":" & DatePart("n",strForumTimeAdjust) & ":" & DatePart("s",strForumTimeAdjust) end if StrToDate = tmpDate end if end function
But what to do with it? |
Alfred The Battle Group CREDO
|
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 19 October 2003 : 20:31:19
|
Get the value from the DB and call the function with it. The function will then return the value you can use in your SQL statement. Here is an example:
myDate = StrToDate(rs(M_DATE))
|
Snitz 3.4 Readme | Like the support? Support Snitz too |
|
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 19 October 2003 : 22:22:34
|
Actually if you are trying to get the past 30 days of new members you will need to do something like the following...
1. Grab todays date and 30 days ago date and convert them using the DateToStr function 2. Run your sql query to grab numbers between the two days.
Here is a real quick example if you are using the snitz database and just want to grab the last members of a certain time frame...
strCurrentDate = DateToStr(Now)
strPreviousDay = DateToStr(DateAdd("d",-30,Now()))
strSql = "SELECT COUNT(MEMBER_ID) AS NAME_COUNT FROM FORUM_MEMBERS WHERE M_DATE > '" & strPreviousDay & "' AND M_DATE < '" & strCurrentDate & "'"
|
Brad Oklahoma City Online Entertainment Guide Oklahoma Event Tickets |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 19 October 2003 : 22:42:08
|
Aha - that was the part I still couldn't figure out! This seems to work fine now. Does AND M_DATE < '" & strCurrentDate & " not exclude today's date? And how would one have to specify say "the current month" rather than the last 30 days? |
Alfred The Battle Group CREDO
|
Edited by - Alfred on 19 October 2003 22:45:21 |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 19 October 2003 : 23:52:00
|
That's right < means less than. If you wanted today's date you would use <= instead (although I haven't tested this)
Wouldn't current month simply be the DateAdd function using m-1 rather than d-30 ? |
|
|
Topic |
|