Querying memo fields

Results 1 to 2 of 2

Thread: Querying memo fields

  1. #1
    Join Date
    Dec 1969

    Default Querying memo fields

    I am querying a database with several memo fields relating to job responsibilities and qualifications. If a memo field is blank, I do not want to return anything. If it has something in it, I want to return the value. <BR><BR>I have written several if then statements to check the value of the memo fields. However, it does not seem to be reading them as blank. It is inserting my <BR> tags from the if then statements when it should not. Does anyone have an answer?<BR><BR>In this case, only the res1 and res2 have values, however, it is inserting the <BR> tags for res3, res4, and res5 instead of reading the Response.write "".<BR><BR>Thanks for any help.<BR><BR>Code:<BR><BR>&#060;%<BR>dim objConn<BR>dim objRec<BR>dim strId<BR><BR>strId = Request.QueryString("id")<BR><BR>Set objConn = Server.CreateObject ("ADODB.Connection")<BR>Set objRec = Server.CreateObject ("ADODB.Recordset")<BR>MdbFilePath = Server.MapPath("../../../odbc/kiewit.mdb")<BR> objConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & MdbFilePath & ";"<BR><BR>&#039;objConn.Open "DSN=kiewit"<BR>objRec.Open "positions", objConn, 0, 1, 2<BR><BR>objRec.Filter = "ID = &#039;" & strID & "&#039;"<BR><BR>dim res1, res2, res3, res4, res5<BR>res1 = objRec("responsibilities1")<BR>res2 = objRec("responsibilities2")<BR>res3 = objRec("responsibilities3")<BR>res4 = objRec("responsibilities4")<BR>res5 = objRec("responsibilities5")<BR><BR>Do While Not objRec.EOF<BR> Response.Write "Position: " & objRec("position") & "<BR><BR>" <BR> Response.Write "Responsibilities: <BR>"<BR> If Trim(res1) = "" Then<BR> Response.write ""<BR> else<BR> Response.write res1 & "<BR><BR>"<BR> end if<BR> If Trim(res2) = "" Then<BR> Response.write ""<BR> else<BR> Response.write res2 & "<BR><BR>"<BR> end if<BR> If Trim(res3) = "" Then<BR> Response.write ""<BR> else<BR> Response.write res3 & "<BR><BR>"<BR> end if<BR> If Trim(res4) = "" Then<BR> Response.write ""<BR> else<BR> Response.write res4 & "<BR><BR>"<BR> end if<BR> If Trim(res5) = "" Then<BR> Response.write ""<BR> else<BR> Response.write res5 & "<BR><BR>"<BR> end if<BR> Response.Write "&#060;/ul&#062;"<BR> Response.Write "<BR><BR>E-mail Contact: &#060;a href=&#039;mailto:" & objRec("email") & "?subject=Attn: Human Resources Manager&#039;&#062;" & objRec("email") & "&#060;/a&#062;"<BR> objRec.MoveNext<BR>Loop<BR><BR>objRec.Close<BR>obj Conn.Close<BR>Set objRec = Nothing<BR>Set objConn = Nothing<BR>%&#062;

  2. #2
    J. Paul Schmidt Guest

    Default RE: Querying memo fields

    To check for a blank memo field from a database, perhaps you should test for Null instead of testing for "".<BR><BR>Best regards,<BR>-Paul<BR><BR>J. Paul Schmidt, MBA<BR>Databases on the Web<BR>http://www.Bullschmidt.com<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