Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2003
    Posts
    292

    Unanswered: updating blank spaces...

    Hi,

    I have an updating problem..

    When the user pulls up the record he has the option to update that record... if the user fills in that field then everything is fine.. but if the user deletes something out of that field and updates it..

    It updates it with a blank space in that field..

    Heres is the part of the code that updates a blank space in that field

    FLT.SetFocus
    f6 = FLT.Text & " "

    I need for it to update with nothing in that field.. that way I can pull the info out of it to graph...

    thanks

  2. #2
    Join Date
    Jan 2004
    Posts
    26
    Try this:

    If Strings.Trim(FLT.text) <> "" and FLT.text <> Null then
    f6 = FLT.Text & " "
    End if

  3. #3
    Join Date
    Jul 2003
    Posts
    292
    Thanks for the response...

    I tried this as you suggested..

    FLT.SetFocus
    If Strings.Trim(FLT.text) <> "" and FLT.text <> Null then
    f6 = FLT.Text & " "
    End if

    now when I go to update my field.. it doesnt update now..

    did i do something wrong ?

    thanks

  4. #4
    Join Date
    Jan 2004
    Posts
    26
    Try this:

    If Strings.Trim(FLT.text) <> "" and FLT.text <> Null then
    f6 = FLT.Text & " "
    Else
    f6 = FLT.Text
    End if

  5. #5
    Join Date
    Jul 2003
    Posts
    292
    Ok this is what i did..

    I pulled up the record that need to be edited.. and under field FLT.. there was something already in there.. but I need for it to be blank soo.. I clicked inside the FLT field and backspaced.. to blank that field.. then hit my update button..

    it blanked it out.. ok..

    now i go back and put in the record number .. hit the search.. it pulls up that record.. but the field FLT still has something in there.. which there shouldnt be anything in there..

    I check my table.. and the field FLT was not changed..

    any ideas ?

    thanks

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    as a general observation, avoid "control.text" if you can (which is almost 100% of the time!).
    "control" (for a texbox defaults to "control.value" which is +/- the same) avoids the need for all the .setfocus nonsense.

    back to your question: there is no way to diagnose the problem from the limited info you provide.

    your
    f6 = FLT.Text & " "
    is putting at least a space (& " ") in the field.

    why the & " " ????
    (i saw this in someone else's post yesterday. i'm curious)



    izy
    currently using SS 2008R2

  7. #7
    Join Date
    Jul 2003
    Posts
    292
    well initially the code was went to .. if there was a blank then put a space in that field.. and it would return a blank.. but now that I have to graph that table.. those blank spaces are coming back to hurt me..

    Now I need to know .. what way can I update a blank field without having to put a space..

    thanks

  8. #8
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    depends how you defined your table.
    if you allowed nulls: f6=null
    if you allowed zero length: f6=""
    if you disallowed both, follow Balinor
    ...instead of using [f6] in your query you use ltrim$([f6]).

    ltrim() may not be enough. perhaps:
    iif(len(ltrim([f6]))=0, null, [f6])
    ...much as i hate voluntarily introducing the dreaded null into a query - in fact i've never tried something like that and it may not work

    izy
    currently using SS 2008R2

  9. #9
    Join Date
    Jul 2003
    Posts
    292
    The reason I ask is that I am graphing with this data.. and when there is a blank in that field.. it graphs it as "slice"

    I was thinking.. I already have a form which pulls all data that are not null ... why not just add something that will also ommit " " in my field FLT..

    sqlString = "SELECT Count(tblInspections.FLT) AS CountOfFLT, Left([FLT],2) AS FaultType FROM tblInspections INNER JOIN tblQR ON (tblInspections.strReference = tblQR.strReference) AND (tblInspections.strArea = tblQR.strArea) AND (tblInspections.strProject = tblQR.strProject) WHERE tblInspections.FLT Is Not Null " & sqlString & " GROUP BY Left([FLT],2);"

    I tried :

    sqlString = "SELECT Count(tblInspections.FLT) AS CountOfFLT, Left([FLT],2) AS FaultType FROM tblInspections INNER JOIN tblQR ON (tblInspections.strReference = tblQR.strReference) AND (tblInspections.strArea = tblQR.strArea) AND (tblInspections.strProject = tblQR.strProject) WHERE tblInspections.FLT Is Not Null AND tblInspections.FLT)<>" "" & sqlString & " GROUP BY Left([FLT],2);"

    But that doesnt work...

    Could you or someone correct my code ?

    thanks

Posting Permissions

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