Re: Replace: Problems stripping out Comma for a Integer field



I tried that - and it did not work!

"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:uJkabsVtFHA.3896@xxxxxxxxxxxxxxxxxxxxxxx
> Why not simply use CInt to convert the value to an integer?? Or CLng to
> convert it to a long?
>
> jason@xxxxxxxxxxxxxxx wrote:
>> Interesting problem: If a user puts a Comma into an integer field I
>> will get a data type error.
>>
>> I tried Replacing it with a blank space:
>>
>> FUNCTION FixApos(Var)
>> FixApos=Replace(Var, "'", "")
>> FixApos=Replace(Var, ",", "")
>>
>> END FUNCTION
>>
>> But still pick up the error. Is tis because the Int field sees the
>> empty space as a 'character'?
>>
>> I have no resorted to redirecting user back to form page if there is
>> a comma detected:
>>
>> FUNCTION FixApos(Var)
>> FixApos=Replace(Var, "'", "")
>> FixApos=Replace(Var, ",", "")
>> If Instr(Var,",") then
>>
>> response.redirect "FormAdd.asp?Error=Comma"
>>
>> End If
>> ' this replaces a single apostrophe ( ' ) with two single apostrophes
>> ( ''). Note: two single apostrophes, not one quotation mark
>> END FUNCTION
>>
>>
>> Bsides client side validation there surely has to be a better way to
>> strip out commas for an integer field on the fly. I also tried
>> replacing with a NULL but error said this was inproper use of Replace
>> function.
>>
>> Could really use some help here.
>>
>> Thanks
>> Jason
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>


.



Relevant Pages

  • Re: Replace: Problems stripping out Comma for a Integer field
    ... If a user puts a Comma into an integer field I ... > empty space as a 'character'? ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.db)
  • Re: text file for mail merge stumped
    ... Please reply to the newsgroup unless you wish to avail yourself of my ... Doug Robbins - Word MVP ... Here is my last attempt at macro recording. ... When bringing data in it does not reconize comma ...
    (microsoft.public.word.vba.beginners)
  • Re: Keypad decimal incorrect on some layouts
    ... is mapped to a point, which is wrong, it should be mapped to a comma. ... Multi-posting is not a good habit because it leads to duplication ... one with a regional scope and another with a global scope. ... too that there is no single newsgroup where this issue fits perfectly. ...
    (microsoft.public.windowsxp.general)
  • Re: Replace: Problems stripping out Comma for a Integer field
    ... If a user puts a Comma into an integer field I will ... > I tried Replacing it with a blank space: ... > out commas for an integer field on the fly. ...
    (microsoft.public.inetserver.asp.db)
  • Replace: Problems stripping out Comma for a Integer field
    ... If a user puts a Comma into an integer field I will get ... I tried Replacing it with a blank space: ...
    (microsoft.public.inetserver.asp.db)

Loading