How do I get the Len function to count a space at the end of a string? For
example, if I enter AB(space), how do I get Len to return 3 instead of 2?
Thanks,
Steve 11 10573
"PC Datasheet" <no****@nospam.spam> wrote in message
news:ly******************@newsread1.news.atl.earth link.net... How do I get the Len function to count a space at the end of a string? For example, if I enter AB(space), how do I get Len to return 3 instead of 2?
Thanks,
Steve
Len will include a space at the end of a string.
?len("AB ")
3
Thanks for responding, Randy!
I have two textboxes and a button on a form. I can enter a string in
MyTextBox and have code in the click event of the button to use the Len
function to output the number of characters I entered in MyTextBox. The
button code is:
Me!MyLenOfString = Len(Me!MyTextBox)
If I type AB(space) in the textbox and click the button, 2 appears in
MyLengthOfString instead of 3.
Steve
"Randy Harris" <ra***@SpamFree.com> wrote in message
news:P2**********@newssvr24.news.prodigy.net... "PC Datasheet" <no****@nospam.spam> wrote in message news:ly******************@newsread1.news.atl.earth link.net... How do I get the Len function to count a space at the end of a string? For example, if I enter AB(space), how do I get Len to return 3 instead of 2?
Thanks,
Steve
Len will include a space at the end of a string.
?len("AB ") 3
PC Datasheet wrote: Thanks for responding, Randy!
I have two textboxes and a button on a form. I can enter a string in MyTextBox and have code in the click event of the button to use the Len function to output the number of characters I entered in MyTextBox. The button code is: Me!MyLenOfString = Len(Me!MyTextBox)
If I type AB(space) in the textbox and click the button, 2 appears in MyLengthOfString instead of 3.
Steve
"Randy Harris" <ra***@SpamFree.com> wrote in message news:P2**********@newssvr24.news.prodigy.net... "PC Datasheet" <no****@nospam.spam> wrote in message news:ly******************@newsread1.news.atl.earth link.net... How do I get the Len function to count a space at the end of a string? For example, if I enter AB(space), how do I get Len to return 3 instead of 2?
Thanks,
Steve
Len will include a space at the end of a string.
?len("AB ") 3
http://groups.google.com/group/comp....4ecee81?hl=en&
James A. Fortune
If you have been aided by this answer, please consider a donation to
the following PayPal URL... :-).
"PC Datasheet" <no****@nospam.spam> wrote in message
news:Td******************@newsread1.news.atl.earth link.net... Thanks for responding, Randy!
I have two textboxes and a button on a form. I can enter a string in MyTextBox and have code in the click event of the button to use the Len function to output the number of characters I entered in MyTextBox. The button code is: Me!MyLenOfString = Len(Me!MyTextBox)
If I type AB(space) in the textbox and click the button, 2 appears in MyLengthOfString instead of 3.
Steve
It's the text box that stripping your trailing space, not the len function.
You can confirm this rather easily.
In the form module create a int variable at the module level.
Dim intLen as Integer
In the BeforeUPdate event of the text box add:
intLen = Len(Me.tbxControl.Text)
Note: You have to use the .Text property to get the pre saved data.
Have your command button do:
MsgBox "Length of string:" & intLen
intLen will contain the length of the data in the text box, including any
trailing spaces.
Randy
You're testing the Value property which returns the underlying data not the
text you entered.
Access does not store boiler plate data, it trims trailing spaces (bad
design IMO), hence 2 instead of 3.
Terry Kreft
"PC Datasheet" <no****@nospam.spam> wrote in message
news:Td******************@newsread1.news.atl.earth link.net... Thanks for responding, Randy!
I have two textboxes and a button on a form. I can enter a string in MyTextBox and have code in the click event of the button to use the Len function to output the number of characters I entered in MyTextBox. The button code is: Me!MyLenOfString = Len(Me!MyTextBox)
If I type AB(space) in the textbox and click the button, 2 appears in MyLengthOfString instead of 3.
Steve
"Randy Harris" <ra***@SpamFree.com> wrote in message news:P2**********@newssvr24.news.prodigy.net... "PC Datasheet" <no****@nospam.spam> wrote in message news:ly******************@newsread1.news.atl.earth link.net... How do I get the Len function to count a space at the end of a string? For example, if I enter AB(space), how do I get Len to return 3 instead of 2?
Thanks,
Steve
Len will include a space at the end of a string.
?len("AB ") 3
Terry Kreft wrote: Access does not store boiler plate data, it trims trailing spaces (bad design IMO), hence 2 instead of 3.
Terry, unrelated question (apologies to Steve for hijacking his thread),
but what do you mean by "boiler plate" data in this case? It's not a
trick question... 8) I've used the expression a number of times myself
without a deep understanding of what "boiler plate" meant.... Thanks
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Tim,
What I mean is, data as it is entered.
--
Terry Kreft
"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:di**********@coranto.ucs.mun.ca... Terry Kreft wrote:
Access does not store boiler plate data, it trims trailing spaces (bad design IMO), hence 2 instead of 3.
Terry, unrelated question (apologies to Steve for hijacking his thread), but what do you mean by "boiler plate" data in this case? It's not a trick question... 8) I've used the expression a number of times myself without a deep understanding of what "boiler plate" meant.... Thanks
-- Tim http://www.ucs.mun.ca/~tmarshal/ ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Terry,
Thanks for responding!
Is there a way to check if a space is entered?
Steve
"Terry Kreft" <te*********@mps.co.uk> wrote in message
news:wF********************@karoo.co.uk... You're testing the Value property which returns the underlying data not the text you entered.
Access does not store boiler plate data, it trims trailing spaces (bad design IMO), hence 2 instead of 3.
Terry Kreft
"PC Datasheet" <no****@nospam.spam> wrote in message news:Td******************@newsread1.news.atl.earth link.net... Thanks for responding, Randy!
I have two textboxes and a button on a form. I can enter a string in MyTextBox and have code in the click event of the button to use the Len function to output the number of characters I entered in MyTextBox. The button code is: Me!MyLenOfString = Len(Me!MyTextBox)
If I type AB(space) in the textbox and click the button, 2 appears in MyLengthOfString instead of 3.
Steve
"Randy Harris" <ra***@SpamFree.com> wrote in message news:P2**********@newssvr24.news.prodigy.net... "PC Datasheet" <no****@nospam.spam> wrote in message news:ly******************@newsread1.news.atl.earth link.net... How do I get the Len function to count a space at the end of a string? For example, if I enter AB(space), how do I get Len to return 3 instead of 2?
Thanks,
Steve
Len will include a space at the end of a string.
?len("AB ") 3
My actual situation is that I have a continuous form with an unbound textbox
in the form header. The recordsource of the form is a query that uses the
value in the unbound textbox in the criteria of one of the fields. I use the
Change event in the textbox to run code to requery the form. I need to be
able to type AB(space)C in the textbox.
The following works --------------
Put the following under Option Compare Database:
Dim LenOfSearchFor as Integer
Put the following in the form's module:
Private Sub SearchFor_BeforeUpdate(Cancel As Integer)
LenOfSearchFor = Len(Me!SearchFor.Text)
End Sub
Private Sub SearchFor_Change()
Me.Requery
Me!SearchFor.SetFocus
If IsNull(Me!SearchFor.Text) = False Then
If LenOfSearchFor > Len(Me!SearchFor) Then
Me!SearchFor = Me!SearchFor & " "
End If
Me!SearchFor.SelStart = LenOfSearchFor + 1
End If
End Sub
Jim Fortune noted that Access won't automatically remove trailing
spaces that have been added through code.
Steve
"PC Datasheet" <no****@nospam.spam> wrote in message
news:ly******************@newsread1.news.atl.earth link.net... How do I get the Len function to count a space at the end of a string? For example, if I enter AB(space), how do I get Len to return 3 instead of 2?
Thanks,
Steve
On an event of the control (i.e. the control has focus so we can check the
Text property)
If Len(Me.TextBox.Text) > Len(RTrim(Me.TextBox.Text) Then
' There's at least one trailing space in the text
Following on from this you can check how many triling spaces with
trailingspaces = Len(Me.TextBox.Text) - Len(RTrim(Me.TextBox.Text)
--
Terry Kreft
"PC Datasheet" <no****@nospam.spam> wrote in message
news:n1******************@newsread2.news.atl.earth link.net... Terry,
Thanks for responding!
Is there a way to check if a space is entered?
Steve
"Terry Kreft" <te*********@mps.co.uk> wrote in message news:wF********************@karoo.co.uk... You're testing the Value property which returns the underlying data not the text you entered.
Access does not store boiler plate data, it trims trailing spaces (bad design IMO), hence 2 instead of 3.
Terry Kreft
"PC Datasheet" <no****@nospam.spam> wrote in message news:Td******************@newsread1.news.atl.earth link.net... Thanks for responding, Randy!
I have two textboxes and a button on a form. I can enter a string in MyTextBox and have code in the click event of the button to use the Len function to output the number of characters I entered in MyTextBox. The button code is: Me!MyLenOfString = Len(Me!MyTextBox)
If I type AB(space) in the textbox and click the button, 2 appears in MyLengthOfString instead of 3.
Steve
"Randy Harris" <ra***@SpamFree.com> wrote in message news:P2**********@newssvr24.news.prodigy.net...
"PC Datasheet" <no****@nospam.spam> wrote in message news:ly******************@newsread1.news.atl.earth link.net... > How do I get the Len function to count a space at the end of a string? > For > example, if I enter AB(space), how do I get Len to return 3 instead of > 2? > > Thanks, > > Steve >
Len will include a space at the end of a string.
?len("AB ") 3
Saved the last two lines for future reference.
Thanks, Terry!
"Terry Kreft" <te*********@mps.co.uk> wrote in message
news:cS********************@karoo.co.uk... On an event of the control (i.e. the control has focus so we can check the Text property)
If Len(Me.TextBox.Text) > Len(RTrim(Me.TextBox.Text) Then ' There's at least one trailing space in the text
Following on from this you can check how many triling spaces with trailingspaces = Len(Me.TextBox.Text) - Len(RTrim(Me.TextBox.Text) -- Terry Kreft
"PC Datasheet" <no****@nospam.spam> wrote in message news:n1******************@newsread2.news.atl.earth link.net... Terry,
Thanks for responding!
Is there a way to check if a space is entered?
Steve
"Terry Kreft" <te*********@mps.co.uk> wrote in message news:wF********************@karoo.co.uk... You're testing the Value property which returns the underlying data not the text you entered.
Access does not store boiler plate data, it trims trailing spaces (bad design IMO), hence 2 instead of 3.
Terry Kreft
"PC Datasheet" <no****@nospam.spam> wrote in message news:Td******************@newsread1.news.atl.earth link.net... Thanks for responding, Randy!
I have two textboxes and a button on a form. I can enter a string in MyTextBox and have code in the click event of the button to use the Len function to output the number of characters I entered in MyTextBox. The button code is: Me!MyLenOfString = Len(Me!MyTextBox)
If I type AB(space) in the textbox and click the button, 2 appears in MyLengthOfString instead of 3.
Steve
"Randy Harris" <ra***@SpamFree.com> wrote in message news:P2**********@newssvr24.news.prodigy.net... > > "PC Datasheet" <no****@nospam.spam> wrote in message > news:ly******************@newsread1.news.atl.earth link.net... >> How do I get the Len function to count a space at the end of a >> string? For >> example, if I enter AB(space), how do I get Len to return 3 instead >> of 2? >> >> Thanks, >> >> Steve >> > > Len will include a space at the end of a string. > > ?len("AB ") > 3 >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: |
last post by:
Hello All, this is my first post.
OK - The goal is to display the following (note: substitute 1' ' for 2'*')
by using 3 recursive functions.
0123454321001234543210
**012343210012343210**...
|
by: |
last post by:
OK:
Purpose: Using user's input and 3 recursive functions, construct an hour
glass figure. Main can only have user input, loops and function calls.
Recursive function 1 takes input and displays...
|
by: Michael |
last post by:
Guys,
I'm interested in how the compiler implements function calls, can anyone
correct my understanding/point me towards some good articles.
When a function is called, is the stack pointer...
|
by: Java and Swing |
last post by:
static PyObject *wrap_doStuff(PyObject *self, PyObject *args) {
// this will store the result in a Python object
PyObject *finalResult;
// get arguments from Python
char *result = 0;
char *in=...
|
by: Clive Page |
last post by:
What I'd like to do is use dblink to extract a few rows from a remote
database and manipulate these within a function in pl/pgsql. Something
like this:
CREATE OR REPLACE FUNCTION find() RETURNS...
|
by: Jeff Rodriguez |
last post by:
Main just loops over this while it's not null. The segfault occurs at
this line:
*line = (char)ch;
Also, please don't just fix the code. I would like to know why exactly
this isn't working so I...
|
by: DAnne |
last post by:
I'm trying to do a simple count function in xslt and it's turning out to be extremely painful.
I have a report that brings back a set of responses for each question per section in an Audit.
I...
|
by: Adam |
last post by:
Hi,
I'd like to return an (arbitrary length) string array from a function so
that after calling the array I've got a list of strings I can access.
After much perusing of the internet I found a...
|
by: lovecreatesbea... |
last post by:
It takes mu so time to finish this C source code line count function.
What do you think about it?
/
*******************************************************************************
* Function ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |