修复名称记录集 [英] Fixing names recordset

查看:70
本文介绍了修复名称记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我最近遇到了一个我收到的数据库的问题。基本上,给我的数据有一个字段名称OWNERNAME。我使用它打印到预先打印的文本框中,因此名称的大小限制为大约25个字符。我认为需要一些VBA解决的问题是,名称有以下格式。


Brett Smith

Brett&玛丽史密斯

布雷特史密斯& Mary White

Brett Smith先生& Mary White

Brett Smith先生&玛丽怀特夫人。


所以基本上你可以想到的所有格式都有更长的名字。我真的需要一些可以读取名字的东西给我第一个初始名字和姓氏并转储所有MR和Mrs Etc,所以最后的输出将是上面的。


B.史密斯

B& M Smith

B& M white

B Smith& M White

B Smith& M White


我刚刚在VB.net中做过中级编程。我没有真正做过任何VBA,但它看起来很相似,并且有很多工作我相信我可以集合一些东西。我刚刚在这里看看是否有人有一些代码可以解决这个问题,或者可以指出我正确的方向。关于VBA的好书推荐会受到欢迎,因为我不会深入了解这一点,它看起来非常方便我将在未来几个月内与人们的数据一起工作,看到我已经开始了一份新工作这个区域。


任何帮助都将不胜感谢


我正在运行

Windows XP

和Access 2003

Hello,

I have recently come across a problem with a database I have received. Basically the data being given to me has a field name OWNERNAME. I am using this to print into a pre printed text box so the size of the names are limited to about 25 character. The problem, which I think will need some VBA to solve, is that the name are in the following formats.

Brett Smith
Brett & Mary Smith
Brett Smith & Mary White
Mr Brett Smith & Mary White
Mr Brett Smith & Mrs Mary White.

So basically every format you can think of with longer names also. I really need something that can read through the name Give me first intial and Last name and dump all MR and Mrs Etc so the output in the end would be for the above.

B. Smith
B & M Smith
B S & M white
B Smith & M White
B Smith & M White

I have done up to intermediate programing a while ago in VB.net. I haven''t really done any VBA but it look similar and with a a lot of work I''m sure I can muster something up. I just popped on here to see if any one has some code good to go for this problem or can point me in the right direction. A good book recommendation on VBA would be welcomed to because I wouldn''t my learning this in depth, it looks really handy and I will be working alot with people''s data in the coming months seeing I have started a new job in this area.

Any help would be appreciated thanks

I am running
Windows XP
And Access 2003

推荐答案


你好,


我最近遇到了一个我收到的数据库的问题。基本上,给我的数据有一个字段名称OWNERNAME。我使用它打印到预打印的文本框中,因此名称的大小限制为大约25个字符。我认为需要一些VBA解决的问题是,名称有以下格式。


Brett Smith

Brett&玛丽史密斯

布雷特史密斯& Mary White

Brett Smith先生& Mary White

Brett Smith先生&玛丽怀特夫人。


所以基本上你可以想到的所有格式都有更长的名字。我真的需要一些可以读取名字的东西给我第一个初始名字和姓氏并转储所有MR和Mrs Etc,所以最后的输出将是上面的。


B.史密斯

B& M Smith

B& M white

B Smith& M White

B Smith& M White


我刚刚在VB.net中做过中级编程。我没有真正做过任何VBA,但它看起来很相似,并且有很多工作我相信我可以集合一些东西。我刚刚在这里看看是否有人有一些代码可以解决这个问题,或者可以指出我正确的方向。关于VBA的好书推荐会受到欢迎,因为我不会深入了解这一点,它看起来非常方便我将在未来几个月内与人们的数据一起工作,看到我已经开始了一份新工作这个区域。


任何帮助都将不胜感谢


我正在运行

Windows XP

和Access 2003
Hello,

I have recently come across a problem with a database I have received. Basically the data being given to me has a field name OWNERNAME. I am using this to print into a preprinted text box so the size of the names are limited to about 25 character. The problem, which I think will need some VBA to solve, is that the name are in the following formats.

Brett Smith
Brett & Mary Smith
Brett Smith & Mary White
Mr Brett Smith & Mary White
Mr Brett Smith & Mrs Mary White.

So basically every format you can think of with longer names also. I really need something that can read through the name Give me first intial and Last name and dump all MR and Mrs Etc so the output in the end would be for the above.

B. Smith
B & M Smith
B S & M white
B Smith & M White
B Smith & M White

I have done up to intermediate programing a while ago in VB.net. I haven''t really done any VBA but it look similar and with a a lot of work I''m sure I can muster something up. I just popped on here to see if any one has some code good to go for this problem or can point me in the right direction. A good book recommendation on VBA would be welcomed to because I wouldn''t my learning this in depth, it looks really handy and I will be working alot with people''s data in the coming months seeing I have started a new job in this area.

Any help would be appreciated thanks

I am running
Windows XP
And Access 2003

这个过程需要多个步骤,它已经过了我的睡觉时间,所以我会给你第一步。 / b>

  1. 从姓名中删除所有先生,先生,夫人和夫人。
  2. 复制并将以下公共函数粘贴到标准代码模块。这将从名称中删除前面提到的标题。不要改变If..ElseIf的顺序...... Else ... End If构造因为排序很关键。
  1. Remove all occurrences of Mr, Mr., Mrs, and Mrs. from the Name.
  2. Copy and Paste the following Public Function to a Standard Code Module. This will remove the before-mentioned Titles from the Names. Do not change the order of the If..ElseIf...Else...End If construct since the ordering is critical.
展开 | 选择 | 换行 | 行号


表的名称是Test。


我进入访问点击模块并转到新模块。


我剪切并粘贴代码并将其保存为名称fRemoveMrMrs


我认为这是正确的名称。


然后我通过查询然后查看sql视图并粘贴查询来创建查询在
The name of the table is Test.

I went into access clicked on modules and went to new module.

I cut and pasted the code and saved it with the name fRemoveMrMrs

I presume that is the correct name to use.

I then created the query by going to query then sql view and pasting your query in
展开 | 选择 | Wrap | 行号


在保存模块时请记住,它不能与公共函数同名。您需要将其重命名为fRemoveMrMrs以外的其他内容。


还要确保从代码示例中复制了PUBLIC FUNCTION fRemoveMrMrs行。


希望有所帮助,


Joe P。
Keep in mind when you save the Module, it can''t be the same name as the public function. you need to rename it something other than fRemoveMrMrs.

Also make sure that you copied the PUBLIC FUNCTION fRemoveMrMrs line from the code example.

Hope that helps,

Joe P.


这篇关于修复名称记录集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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