Rocky Smolin at Beach Access Software
rockysmolin at bchacc.com
Wed Nov 14 00:20:49 CST 2007
A.D.:
A modification. Or subset. Looking at your code I could see that it was
the .Text property that I was missing. So instead of making the row source
WHERE clauses from the text boxes, I stored the contents of the text boxes
in strings using the .Text property (strLastName = Me.txtLastName.Text).
The strings have the trailing blank so I use the strings to construct the
WHERE clause instead of the contents of the text boxes.
This works well to insert one blank. But it won't do more than one blank.
I know how to solve this with a bit of code but I have to ask the client if
that's really necessary. The original requirement for the blank was a
company named R & R. The client wanted to filter on that. I think the need
to filter on a string that contains two blanks is astronomically small. But
I'll ask.
With best regards,
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of A.D.TEJPAL
Sent: Tuesday, November 13, 2007 10:03 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Blanks in text box
Rocky,
Were you able to try the solution given in my post of 13-Nov-2007 ?
A.D.Tejpal
------------
----- Original Message -----
From: A.D.TEJPAL
To: Access Developers discussion and problem solving
Cc: A.D.TEJPAL
Sent: Tuesday, November 13, 2007 20:24
Subject: Re: [AccessD] Blanks in text box
Rocky,
You wish to trap the trailing spaces in a text box, while using its
contents for applying filter. This calls for certain special measures as
trailing spaces (if any) get lost while exiting the text box.
Sample code in form's module, as given below, demonstrates application
of filter on a subform, duly taking into account the contents of text box
(including trailing spaces if any) located on the parent form.
Best wishes,
A.D.Tejpal
------------
Sample code in form's module
Txt1 is the name of text box where criteria string is
entered. SF_Sub is the name of control holding the
subform. Clicking command button named CmdFilter
applies filter on subform records - duly taking into
account the trailing blanks (if any) in text box Txt1
PCode is the name of field on which filter is applied.
'=================================
' Declarations section
Private RefTxt As String
'--------------------------------------------------
Private Sub CmdFilter_Click()
With Me.SF_Sub.Form
.Filter = "PCode Like '" & RefTxt & "*'"
.FilterOn = True
End With
End Sub
'--------------------------------------------------
Private Sub Txt1_Change()
RefTxt = ActiveControl.Text
End Sub
'--------------------------------------------------
Private Sub Txt1_Enter()
RefTxt = ActiveControl.Text
End Sub
'=================================
----- Original Message -----
From: Rocky Smolin at Beach Access Software
To: 'Access Developers discussion and problem solving'
Sent: Tuesday, November 13, 2007 07:17
Subject: Re: [AccessD] Blanks in text box
It the text box where I want to have the trailing blanks retained. I'm
setting the filter for the text box in a subroutine that's called from
the
Change event of the text box.
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Monday, November 12, 2007 4:59 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Blanks in text box
What is the "it" that won't accept and retain trailing blanks, Rocky,
the
list box, the textbox, the filter, or what? If you're trapping
keystrokes,
make sure you aren't including a Trim in there somewhere.
Charlotte Foust
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
at
Beach Access Software
Sent: Monday, November 12, 2007 4:24 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Blanks in text box
Dear List:
I am trapping keystrokes in a text box and setting a filter in a list
box
based on the current value in the text box. But it won't accept and
retain
trailing blanks. If my client wants to search on R & R for example, he
presses R and the list box of names is filtered to all those beginning
with
R. if he then presses the space bar, it should show all the name
beginning
with R-blank. But of course, it strips the trailing blank.
Is there some trick to getting the trailing blanks to be included in the
string?
MTIA
Rocky
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.31/1129 - Release Date: 11/13/2007
9:22 PM