enter space or leave as null

Results 1 to 2 of 2

Thread: enter space or leave as null

  1. #1
    troy Guest

    Default enter space or leave as null

    Right now on all of my forms I enter a " " into the db if a field is null. Is there a way I can leave the field blank without causing errors in the future, or is this the best way? It might be my coding but I get an error if I do the following:<BR><BR>peseudocode (probally not spelled right)<BR>fieldValue = &#039;null<BR>custID = 5<BR><BR>select fieldValue where custID = 5<BR>variable = RS("fieldValue")<BR><BR>(I know this isn&#039;t valid syntax but I am asking about the theory)<BR><BR>How would I query to see if a field is null or not?

  2. #2
    Join Date
    Dec 1969

    Default RE: enter space or leave as null

    Not sure I exactly understand what you&#039;re looking for, but maybe this will help.<BR><BR>Nulls pretty much drive me crazy.<BR><BR>I know in MS Access you can set text/memo fields to "Allow Zero Length", and you won&#039;t get an error if you make rs("myfield") = "".<BR><BR><BR>I have a lot of code that checks for empty strings before writing to the database:<BR><BR>If Request.Form("myformelement") = "" Then<BR> rs("myfield") = Null<BR>Else<BR> rs("myfield") = Request.Form("myformelement") <BR>End If<BR><BR>You can test field values for null using IsNull:<BR><BR>If IsNull(rs("myfield")) Then<BR> myString = ""<BR>Else<BR> myString = rs("myfield")<BR>End If<BR><BR>Hope this helps<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