removing the ";"

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

I am writing code that will edit an existing SQL statement
by adding a "WHERE" clause to the end of it, thus adding
user inputed criteria. Problem is, the existing SQL has
a ";" at the end of. To add the "WHERE" clause, and have
it work, I need the ; to go away. Please let me know if
there is a way to do this. Thank you for any help.
 
For starters, you can use the Left() and Len() functions in tandem. Like this

MyNewSql=left(MyOldSql,Len(MyOldSql)-1) & ....add new code here

The Len() function will return the length of the entire string, the Left() function, with the "-1", will tell it to ignore the last byte (the ";"), and now you're ready to add new code

Good Luck
 
Back
Top