More help with formatting memo fields, please.

Results 1 to 3 of 3

Thread: More help with formatting memo fields, please.

  1. #1
    Zola Guest

    Default More help with formatting memo fields, please.

    Scott wrote that I needed to use the Replace function (with the letters RB to be replaced with BR):<BR><BR>&#039Read in the value of the memo field into a variable<BR>Dim strBlah<BR>strBlah = objRS("MemoField")<BR><BR>&#039Now, replace all carraige returns with &#060;RB&#062;<BR>strBlah = Replace(strBlah, vbCrLf, "&#060;RB&#062;")<BR><BR>I am a bit confused now, but my second question disappeared at the end of the board. <BR><BR>My code looks like this: <BR><BR>&#060;%Username = request.form("Username")<BR>Password = request.form("Password")<BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn.op en "futurenow", "", ""<BR>Set rsLogin = Server.CreateObject("ADODB.Recordset")<BR>SQL = "SELECT Username, Password, Admin FROM Users WHERE Username = &#039" & Username & "&#039 AND Password = &#039" & Password & "&#039 AND Admin = TRUE "<BR> sql, conn, 3, 3<BR>if rsLogin.eof = False then<BR>Set rsNew = Server.CreateObject("ADODB.Recordset")<BR>SQL = "SELECT * FROM Articles "<BR> sql, conn, 3, 3<BR>rsNew.AddNew<BR>rsNew("ArticleDate") = request.form("ArticleDate")<BR>rsNew("ArticleTitle ") = request.form("ArticleTitle")<BR>rsNew("Header1") = request.form("Header1")<BR>rsNew("ArticleBody1") = request.form("ArticleBody1")<BR>rsNew("Header2") = request.form("Header2")<BR>rsNew("ArticleBody2") = request.form("ArticleBody2")<BR>rsNew("Header3") = request.form("Header3")<BR>rsNew("ArticleBody3") = request.form("ArticleBody3")<BR>rsNew("Header4") = request.form("Header4")<BR>rsNew("ArticleBody4") = request.form("ArticleBody4")<BR>rsNew("Header5") = request.form("Header5")<BR>rsNew("ArticleBody5") = request.form("ArticleBody5")<BR>rsNew("Header6") = request.form("Header6")<BR>rsNew("ArticleBody6") = request.form("ArticleBody6")<BR> <BR>ArticleDate = rsNew("ArticleDate")<BR>ArticleTitle = rsNew("ArticleTitle")<BR>Header1 = rsNew("Header1")<BR>ArticleBody1 = rsNew("ArticleBody1")<BR>Header2 = rsNew("Header2")<BR>ArticleBody2 = rsNew("ArticleBody2")<BR>Header3 = rsNew("Header3")<BR>ArticleBody3 = rsNew("ArticleBody3")<BR>Header4 = rsNew("Header4")<BR>ArticleBody4 = rsNew("ArticleBody4")<BR>Header5 = rsNew("Header5")<BR>ArticleBody5 = rsNew("ArticleBody5")<BR>Header6 = rsNew("Header6")<BR>ArticleBody6 = rsNew("ArticleBody6")%&#062;<BR><BR><BR>The Article Body fields are the memo fields that require formatting. Where in relation to this code would I want to use the replace function, and could someone please help me with the syntax? As you can see, I do not use the DIM command at all yet, as I don&#039t properly understand it. I have looked at both my VB reference and my ASP book, and am more confused than when I started.<BR><BR>I assume that "Dim strBlah" is declaring a set of variables, and that I would name it as I wished, such as DIM strArticleformat or some such....but then:<BR><BR>strBlah = objRS("MemoField")<BR>Would I do this line for each memo field? And should RS be replaced with rsNew, the pertinent recordset that is open? So it would look something like:<BR><BR>DIM strArticleformat<BR>strArticleformat = objRSNew("Articlebody1")<BR>strArticleformat = objRSNew("Articlebody2")<BR>strArticleformat = objRSNew("Articlebody3")<BR>strArticleformat = objRSNew("Articlebody4")<BR>strArticleformat = objRSNew("Articlebody5")<BR>strArticleformat = objRSNew("Articlebody6")<BR><BR>strArticleformat = Replace(strArticleformat, vbCrLf, "&#060;RB&#062;")<BR><BR>If this is correct, then where does it belong? After I call the forms, certainly, but then before or after I declare the variables?<BR><BR>Thank you for your patience with my thick-headedness. <BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: More help with formatting memo fields, please.

    See Below...<BR><BR><BR>ArticleDate = Replace(rsNew("ArticleDate"), vbCrLf, "&#060;RB&#062;")<BR>ArticleTitle = Replace(rsNew("ArticleTitle"), vbCrLf, "&#060;RB&#062;")<BR>... And So On<BR><BR>I don&#039t quite understand the rest of the question after this. Are you trying to concatinate the Article Fields together?<BR><BR>Jerry<BR>

  3. #3
    Zola Guest

    Default RE: More help with formatting memo fields, please.

    Trying to format the memo fields so that they display carriage returns properly. The code is supposed to replace the return with &#060;"BR"&#062; (Scott used RB because the command wouldn&#039t display right on the board)<BR><BR>It is JUST for the memo fields, ArticleBody1 2 3 and so on.<BR><BR>ArticleBody1 = Replace(rsNew("ArticleBody1"), vbCrLf, "&#060;RB&#062;")<BR><BR>would be the syntax then? I know it would have to go after the request.form section, but then would it go before or after the<BR><BR>ArticleDate = RsNew("ArticleDate")<BR>ArticleTitle = RsNew("ArticleTitle")<BR>etc etc<BR><BR>section?<BR><BR>That section is declared that way because the page adds the new record and displays what was added.<BR><BR><BR>

Posting Permissions

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