Access正在使用尾随空格截断我的字符串 [英] Access is truncating my strings with trailing spaces

查看:60
本文介绍了Access正在使用尾随空格截断我的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在通过Access向表格中的某些字段添加字符串。字符串

有时会有尾随空格,我真的需要这样,

但是Access会截断尾随空格。我如何强制Access不要

截断?!


Thanx,


/ Toommy

解决方案

< to *** @ infografix.nu>在消息中写道

news:11 ********************* @ v46g2000cwv.googlegro ups.com ...

大家好,

我正在通过Access向表格中的某些字段添加字符串。字符串
有时会有尾随空格,我真的需要这样,
但是Access会截断尾随空格。如何强制Access不要截断?!




通过GUI,我认为你不能。通过

查询插入尾随空格的数据将保留它们,但是AFAIK你不能通过键盘执行此操作。


-

Rick Brandt,Microsoft Access MVP

电子邮件(视情况而定)至...

在Hunter dot com的RBrandt


< blockquote> to***@infografix.nu 写在

news:11 ****** ***************@v46g2000cwv.googlegro ups.com:

我正在通过Access向表格中的某些字段添加字符串。
字符串有时会有尾随空格,我真的需要这样,但是Access会截断尾随空格。我如何强制
访问不截断?!




我个人无法想到存储尾随空格的原因。

1.如果你要存储HTML的数据,任何空格都会被渲染成一个空格,所以最多会丢失一个空格。 br />

2.在任何情况下,当您检索数据时,更容易填充到所需的长度。


3.如果您需要使用尾随空格进行固定宽度导出,那么

可以通过设置为固定宽度的导出规格轻松处理

(并将相应地填充输出)。


-

David W. Fenton http://www.dfenton.com/

usenet at dfenton dot com http://www.dfenton.com/DFA/


我们什么时候想要在文本框中进行增量搜索

将包含空格?我们如何包含这些空格?


因此,如果我有一个文本框的OnChange事件触发以下代码:


Dim pvPos As整数

Dim pvSQLString As String


DoCmd.Hourglass True

Text20.SetFocus

pvSQLString = Text20.Text

pvPos = Len(Text20.Text)

pvSQLString =" select bdas。* from bdas where bdas.ASNAME like''" &安培; _

pvSQLString& " *''"

Me.RecordSource = pvSQLString

Text20.SetFocus

Me.Text20.SelStart = pvPos

DoCmd.Hourglass False


如何抓住用户输入的一个空格以包含在

中?如果我试图抓住狐狸跳过......,我如何在选择语法中加入
包括喜欢''f *''"


感谢您的帮助。


Scott


David W. Fenton写道:

to***@infografix.nu
新闻中写道:11 ********** ***********@v46g2000cwv.googlegro ups.com:

我正在通过Access向表格中的某些字段添加字符串。
字符串有时会有尾随空格,我真的需要这样,但是Access会截断尾随空格。我如何强制
访问不截断?!



我个人无法想到存储尾随空间的理由。

1如果你要存储HTML的数据,任何空白区域都会被渲染为单个空格,所以最多会丢失一个空格。

2.在任何情况下,当您检索数据时,填充到所需的长度会更容易。

3.如果您需要用于固定宽度导出的尾随空格,那么
使用设置为固定宽度的导出规格很容易处理(并相应地填充输出)。

-
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/




Hi all,

I'' m adding strings to some fields in my table via Access. The strings
sometimes have trailing spaces and I really need to have it that way,
but Access truncates trailing spaces. How can I force Access not to
truncate?!

Thanx,

/Toommy

解决方案

<to***@infografix.nu> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...

Hi all,

I'' m adding strings to some fields in my table via Access. The strings
sometimes have trailing spaces and I really need to have it that way,
but Access truncates trailing spaces. How can I force Access not to
truncate?!



Through the GUI I don''t think you can. Data with trailing spaces inserted via
queries will retain them, but AFAIK you cannot do this from the keyboard.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


to***@infografix.nu wrote in
news:11*********************@v46g2000cwv.googlegro ups.com:

I'' m adding strings to some fields in my table via Access. The
strings sometimes have trailing spaces and I really need to have
it that way, but Access truncates trailing spaces. How can I force
Access not to truncate?!



I personally can''t think of a reason to store trailing spaces.

1. if you''re storing data for HTML, any white space is rendered as a
single space, so at most you''d be losing one space.

2. in any context, it''s easier to pad to the required length when
you retrieve data.

3. if you need the trailing spaces for a fixed-width export, then
that''s easily handled with an export spec that is set to fixed-width
(and will pad the output accordingly).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/


How about when we want to do an incremental search in a text box that
will contain spaces? How do we include the spaces?

So if I have a textbox''s OnChange event firing the follow code:

Dim pvPos As Integer
Dim pvSQLString As String

DoCmd.Hourglass True
Text20.SetFocus
pvSQLString = Text20.Text
pvPos = Len(Text20.Text)
pvSQLString = "select bdas.* from bdas where bdas.ASNAME Like ''" & _
pvSQLString & "*''"
Me.RecordSource = pvSQLString
Text20.SetFocus
Me.Text20.SelStart = pvPos
DoCmd.Hourglass False

How do I grab the one space the user has typed to include in the
Select? If I am trying to grab "The fox jumped over...", how do I
include in the Select syntax "like ''The f*''"

Thanks for any help.

Scott

David W. Fenton wrote:

to***@infografix.nu wrote in
news:11*********************@v46g2000cwv.googlegro ups.com:

I'' m adding strings to some fields in my table via Access. The
strings sometimes have trailing spaces and I really need to have
it that way, but Access truncates trailing spaces. How can I force
Access not to truncate?!



I personally can''t think of a reason to store trailing spaces.

1. if you''re storing data for HTML, any white space is rendered as a
single space, so at most you''d be losing one space.

2. in any context, it''s easier to pad to the required length when
you retrieve data.

3. if you need the trailing spaces for a fixed-width export, then
that''s easily handled with an export spec that is set to fixed-width
(and will pad the output accordingly).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/




这篇关于Access正在使用尾随空格截断我的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆