Posted yesterday-didn't get back here-got lost

Results 1 to 2 of 2

Thread: Posted yesterday-didn't get back here-got lost

  1. #1
    Jolene Guest

    Default Posted yesterday-didn't get back here-got lost

    I have been working on an updateable calendar and it is working fine now. It allows a user to add a function to an asp generated calendar and stores the function by date in an Access database. What I would like to do is add a field, either a checkbox or drop down that would allow the user to make the function repeated for say 1 to 10 years like a birthday or anniversary. The calendar works by clicking on the date in the calendar for the year the user wants to add to and then it is stored in that date and year. <BR><BR>Can anyone help me with the code that would allow them to make it an annual function for anywhere from 1-10 years and insert it into the data base as 1-10 records based on the user selection?<BR><BR>Any help would be appreciated.<BR><BR>Steve Cimino responded:<BR><BR>Show us the SQL code you already have to insert the record. Chances are it will only be a minor addition to the statment you already have.<BR><BR>Here is the code:<BR>Function ChkString(string)<BR> if string = "" then string = " "<BR> ChkString = Replace(string, "&#039", "&#039&#039")<BR>End Function<BR><BR>set my_conn= Server.CreateObject("ADODB.Connection")<BR>my_Conn .Open "DSN=diary"<BR><BR><BR>StrSql= "Select * from diary where dte = #" & Request("view_Date") & "#"<BR>set rs = my_conn.Execute (StrSql)<BR><BR>if rs.BOF or rs.EOF then <BR> StrSql ="INSERT INTO diary (dte, text_field) values (#" & request("view_date") & "#, &#039" & chkString(request("txt")) & "&#039)"<BR>else <BR> StrSql = "UPDATE diary SET diary.dte = #" & request("view_date") & "#, text_field = &#039" & chkString(request("txt")) & "&#039 WHERE id = " & rs("id")<BR>End If<BR><BR>my_conn.Execute (strSql)<BR><BR>my_Conn.Close<BR>set my_conn = nothing<BR><BR>Response.Redirect ("diary.asp?view_date=" & request("view_date"))

  2. #2
    Steve Cimino Guest

    Default RE: Posted yesterday-didn't get back here-got

    Why not just add a yes/no field named &#039repeating&#039? Or, you can make it a number, and have that repeat the number of years?<BR><BR>Once you add the field, just add the extra statement to your query. If you&#039re using the number of years solution, have a drop down box asking the user how many years he wants to repeat.<BR><BR>Then, do this:<BR><BR>INSERT INTO diary .... VALUES(...Request.Form("repeating"))<BR><BR>UPDATE diary SET repeating = Request.Form("repeating")....<BR><BR>Either way, you can also use a boolean value to make it default repeating forever (like MS Outlook&#039s recurring appointments)<BR><BR>If this doesn&#039t help, repost.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts