vba 如何使用 Microsoft Access 在备注字段中查找单词

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3139813/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 11:47:57  来源:igfitidea点击:

How to find words in a memo field with microsoft access

ms-accessvba

提问by Jonathan Lyon

This is more complex than I thought as I need to do it with VBA. So here is my problem:-

这比我想象的要复杂,因为我需要用 VBA 来完成。所以这是我的问题:-

I have two tables in an MS Access DB, content and adjectives.

我在 MS Access DB 中有两个表,内容和形容词。

The content table has over 5,000 text snippet rows in a memo field (content) and a blank text field (adjective). The adjectives table has 120 adjectives with the field (adjective).

内容表在备注字段(内容)和空白文本字段(形容词)中有 5,000 多个文本片段行。形容词表有 120 个带有字段(形容词)的形容词。

I need to check if the text snippet contains any of the adjectives and if so, add the adjective to the adjective field. If there is more than one adjective just add the first one.

我需要检查文本片段是否包含任何形容词,如果是,请将形容词添加到形容词字段。如果有多个形容词,只需添加第一个。

Here's an example of the data:-

以下是数据示例:-

CONTENT

内容

"The N8 camera is pretty amazing, will it bring the N8 full on sales success though alone? It's the only "wow" factor of the handset but other handsets have 720p that are also very good such as the Sony Vivaz which a family member has and the videos are pretty amazing from it too."

“N8 的相机非常棒,它会不会让 N8 单枪匹马地销售成功?这是手机唯一的“哇”因素,但其他手机的 720p 也非常好,例如家庭成员拥有的 Sony Vivaz视频也非常棒。”

ADJECTIVES

形容词

afraid
agreeable
amused
ancient
amazing
angry
annoyed
anxious
arrogant
ashamed
average
awful
bad
beautiful
etc

害怕
愉快
逗乐
古代
惊人
愤怒
恼怒
焦虑
傲慢
羞耻
平均
可怕
糟糕
美丽

How would I go about doing this is an update query or in VBA?

我将如何进行更新查询或在 VBA 中执行此操作?

Thanks in advance for your help.

在此先感谢您的帮助。

Jonathan

乔纳森

回答by Fionnuala

Perhaps:

也许:

SELECT a.Adjectives, b.Content
FROM A, B
WHERE b.Content Like "*" & a.[adjectives] & "*"

To update a third table:

更新第三个表:

INSERT INTO C (ContentID, ContentAdjective) 
SELECT b.ID, a.Adjectives
FROM A, B
WHERE b.Content Like "*" & a.[adjectives] & "*"