473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem with text box and automatic space removal

Hi,

Hopefully someone can help me. I have setup a continuous form that displays
customer names and addresses. I have then place a txt box on the form
header. Using the onChange event I've setup some VBA to update the record
source on the form based on the data entered into the text box. The problem
I have is that when if I type some search data containing a space into the
text box, when the requery is finished access appear to automatically remove
the space off the end of my search string. This means that I can't search
for data such as "H S M Tools" I have attached the VBA code below.

I am pretty new to access (only been working with it for 3 weeks) so may
have missed something simple.

Any help would be great
cheers
Dave

------------------ OnChange Event Code ---------------
Dim strSQL As String

strSQL = "SELECT tblCustomer.intCustomerID, tblCustomer.strName,
tblCustomer.strAccountNo, " & _
"tblCustomer.strBranchNo, tblCustomer.strAddressLine1,
tblCustomer.strAddressLine2," & _
"tblCustomer.strAddressLine3, tblCustomer.strAddressLine4,
tblCustomer.strAddressLine5," & _
"tblCustomer.strPostCode, tblCustomer.strContact,
tblCustomer.strPhoneNo, " & _
"tblCustomer.strMobileNo, tblCustomer.strFaxNo,
tblCustomer.strArea, tblCustomer.strType, " & _
"tblArea.strSalesman FROM tblArea INNER JOIN tblCustomer ON
tblArea.strArea=tblCustomer.strArea "

If strSQL <> "" Then
strSQL = strSQL & "WHERE tblCustomer.strName LIKE '" &
Me.txtAccount.Text & "*'"
End If

Me.RecordSource = strSQL

Me.Refresh
Dim intLength As Integer

If Not IsNull(Me.txtAccount) Then
intLength = Len(Me.txtAccount)

If intLength >= 0 Then
Me.txtAccount.SelStart = Len(Me.txtAccount) + 1
End If
End If

Nov 13 '05 #1
2 5046
David Richards wrote:
Hi,

Hopefully someone can help me. I have setup a continuous form that displays customer names and addresses. I have then place a txt box on the form header. Using the onChange event I've setup some VBA to update the record source on the form based on the data entered into the text box. The problem I have is that when if I type some search data containing a space into the text box, when the requery is finished access appear to automatically remove the space off the end of my search string. This means that I can't search for data such as "H S M Tools" I have attached the VBA code below.

I am pretty new to access (only been working with it for 3 weeks) so may have missed something simple.

Any help would be great
cheers
Dave


Access also lops spaces off the end of source code lines and off the
end of a table's field values. Put in a command button that says, "Add
trailing space." Then in the OnClick event put code that looks
something like Text1.Value = Text1.Value & " ". Access won't
automatically remove trailing spaces that have been added through code.
I don't know if there's an internal setting that can change the
automatic space removal.

James A. Fortune

www dot shh dot com -- Dr. Evil

Nov 13 '05 #2
That did the trick, thanks for your help.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marko Pyhajarvi | last post by:
good morning, could anyone help me with this problem? i have made an abstract container from which i have inherited a linkedlist class. this linkedlist uses a smart pointer "counted_ptr<T>"....
102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
15
by: fbachri | last post by:
Hi, I have a form with 1 textbox in the header form area and data in continuous form style in detail area. i would like to make an automatic filter. so when i type a character the data in the...
29
by: Markus Pitha | last post by:
Hello, I read a simple bmp-file with this loop: while ( !feof(fp) ) { printf("%x\n", fgetc(fp)); } fclose(fp); Everything seems to be correct, but at the end of the file, I get a weird
4
by: beena | last post by:
All, I'm new to the concept of automatic storage... I'm looking at the database setup by a vendor. I see few tablespaces showing up with automatic storage - Yes. Tablespace ID ...
0
by: JosAH | last post by:
Greetings, Introduction At the end of the last Compiler article part I stated that I wanted to write about text processing. I had no idea what exactly to talk about; until my wife commanded...
11
by: ramu | last post by:
Hi, Suppose I have a string like this: "I have a string \"and a inner string\\\" I want to remove space in this string but not in the inner string" In the above string I have to remove...
11
by: =?ISO-8859-1?Q?Jean=2DFran=E7ois_Michaud?= | last post by:
Context: I'm trying to compare XML tree fragments and I'm doing so by outputting the attributes of each element in the tree and outputting it to a string then normalizing the strings. Then I'm...
2
by: modeler | last post by:
Hello, I am trying to restore a DB2 9.1 fp2 backup to another DB2 9.1 fp2 machine, both are on Windows. C:\Program Files\IBM\SQLLIB\BIN>db2 -tvf C:\db2_data\test.db2 UPDATE COMMAND OPTIONS...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.