将DLookup值插入表中

时间:2017-06-08 17:26:04

标签: vba ms-access

所以我有两个表,tblMaster和Software。

在MS Access vba中是否有办法在tblMaster.Title上执行DLookup以在软件中查找软件标题并在tblMaster.Software Title中插入值?

tblMaster

|ID|Title                           |type|state|Software Title|
---------------------------------------------------------------
|1 |Adobe Reader                    |A   |Close|
|2 |Apache HTTP Server              |A   |Close|
|3 |Multiple Mozilla Products       |A   |Open |
|4 |Microsoft Windows File Handling |A   |Open |
|5 |Microsoft Windows Client Server |A   |Open |
|6 |HP Printer                      |A   |Open |
|7 |Adobe Acrobat                   |A   |Close|

软件

|SWID|Software Title    |location|
----------------------------------
|1   |Adobe             |1|
|2   |Apache            |1|
|3   |Mozilla           |1|
|4   |Microsoft Windows |2|
|5   |HP                |3|

我希望在DLookup之后tblMaster看起来像这样:

tblMaster

|ID|Title                           |type|state|SWID|Software Title|
---------------------------------------------------------------
|1 |Adobe Reader                    |A   |Close|1   |Adobe
|2 |Apache HTTP Server              |A   |Close|2   |Apache
|3 |Multiple Mozilla Products       |A   |Open |3   |Mozilla
|4 |Microsoft Windows File Handling |A   |Open |4   |Microsoft Windows
|5 |Microsoft Windows Client Server |A   |Open |4   |Microsoft Windows
|6 |HP Printer                      |A   |Open |5   |HP
|7 |Adobe Acrobat                   |A   |Close|1   |Adobe

1 个答案:

答案 0 :(得分:1)

查询可能会得到您想要的内容。应该只是将软件ID保存到tblMaster中,然后构建连接两个表以获取标题的查询。

#!/usr/bin/env python