#1
  1. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Sep 2004
    Posts
    168
    Rep Power
    14

    Another calendar problem???


    Ok, I built a calendar for my companies Intranet that is used for employee vacation, firm events, and other stuff. Right now the users put in the beginning date of the event then put the duration in the description. So what happens is the event shows up on the calendar on the start date with Title 4/15-4/20 (example) date range in the description. To fix this I added an event ending date field and put together the code to get the dates between the start and ending dates. Now the problem I am having is writing the event that is occuring 4/15-4/20 (example) to each day it is happening on the calendar.

    Here is my code to build the calendar:
    Code:
    For n = 1 to nbrCase
    njTemp = n - nDateDebut+1
    if nNumDay = 1 then response.write "<tr>" end if
    response.write "<td align=""left"" valign=""top"" class=""calDay"" height=""125"">"
    if n < (nDateDebut) or n > (nDay2+nDateDebut-1) then
    response.write " "
    Else
    response.write "<a href="""&nURL&"?date="&DateSerial(nYear, nMonth, njTemp)&""">" & njTemp & "</a>" 
    If Not objRS.BOF Then
    objRS.MoveFirst
    Do Until objRS.EOF
    if objRS("evtBDate") = CStr(nMonth) & "/" & CStr(njTemp) & "/" & CStr(nYear) Then
    response.write "<BR>" & objRS("evtName")
    End If
    objRS.MoveNext
     
    Loop
    end if
    end if
    response.write "</td>"
    if nNumDay = 7 then response.write "</tr>" end if
    if nNumDay = 7 then 
    nNumDay = 1 
    else nNumDay = nNumDay + 1 
    end if
    next
     
    %>


    Here is my code to get the dates:
    Code:
    date1=objRS("evtBDate")
    date2=objRS("evtEDate")
    curCount=1
     
    curDiff=DateDiff("d", date1, date2)
    curDate=cDate(date1)+cDate(curDate)
    Do While curCount <> curDiff 
    curNDate=cDate(date1) + curCount
    curCount=curCount + 1
    Loop


    I've been trying to put it all together but something is wrong. I know I can't use the Do While or count because the entries are put on the calendar as it is built. I've been trying to use the existing for..next but my logic and code is wrong.

    I tried:
    Code:
    If Not objRS.BOF Then
    objRS.MoveFirst
    Do Until objRS.EOF
     
    if objRS("evtBDate") = CStr(nMonth) & "/" & CStr(njTemp) & "/" & CStr(nYear) Then
    response.write objRS("evtName") & "<BR>"
     
    if Len(objRS("evtEDate")) <> 0 then
    'objRS("evtBDate") = CStr(nMonth) & "/" & CStr(njTemp) & "/" & CStr(nYear) AND Len(objRS("evtEDate")) <> 0 AND curCount <> curDiff Then
    date1=objRS("evtBDate")
    date2=objRS("evtEDate")
    curEName=objRS("evtName")
    curDate=CStr(nMonth) & "/" & CStr(njTemp) & "/" & CStr(nYear)
    curLater=cDate(curDate) + 1
    curCount=1
    curDiff=DateDiff("d", date1, date2)
    curNDate=cDate(date1) + curCount
    curCount=curCount + 1
    response.write "That That<BR>"
    End if
     
    If curLater = CStr(nMonth) & "/" & CStr(njTemp) & "/" & CStr(nYear) then 
    response.write "This This<BR>" 
    End If
     
    end if
    'end if
    objRS.MoveNext
    Loop
     
    end if
    end if
    This is not working cuz curLater = the next date and CStr.....= current date in loop. Some how I need to pass the next date, event date, and event name back through the for..next loop and make If curLater = CStr......true unless someone has a better way to do this??????
    Thanks!!!
  2. #2
  3. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Sep 2004
    Posts
    168
    Rep Power
    14
    any one?

Similar Threads

  1. working with a MS Access calendar
    By lil_me in forum Microsoft Access Help
    Replies: 2
    Last Post: January 22nd, 2010, 07:56 PM
  2. Wierd problem
    By dev5 in forum ASP Development
    Replies: 6
    Last Post: September 13th, 2004, 03:05 AM
  3. If problem
    By Svenson in forum ASP Development
    Replies: 4
    Last Post: August 24th, 2004, 02:51 PM
  4. Form won't submit problem.
    By nazarael in forum ASP Development
    Replies: 2
    Last Post: October 11th, 2003, 07:49 PM
  5. ASP Database Problem
    By fijjit in forum Microsoft SQL Server
    Replies: 5
    Last Post: February 28th, 2003, 03:55 PM

IMN logo majestic logo threadwatch logo seochat tools logo