Access返回不同的值

时间:2013-04-11 15:45:32

标签: sql database ms-access

我正在使用其他人构建的SharePoint数据库。 我通过Microsoft Access生成一个简单的拉入报表。 我有一切正常工作,但我有一个值,在SharePoint中是一个列表,是一个附加到采购订单的特定买家。在SharePoint中,它返回一个名称值,但在Access中它返回一个#Value值。 我想知道是否有一个简单的修复,当从返回的SharePoint表返回的数据是= to(指定#)时,它将返回(指定的名称)。

现在它将返回说137.我希望它返回买家名称。 遗憾的是条件格式不会扩展到格式以外的东西,并且实际上可能会更改如果[Field]返回[#value]而不是返回[指定的返回值]。

这是我在表格中的查询。我只是直接拉。

SELECT
   [115_12 RFQ's].RFQ, [115 Procurement].PO,
   [115 Procurement].[Issued Date],
   [115 Procurement].[C/O],
   [115 Procurement].Status,
   [115 Procurement].Vendor,
   [115_12 RFQ's].[RFQ Title],
   [115 Procurement].[PO Type],
   [115 Procurement].VDR,
   [115 Procurement].[Approval Drawings Required].Value,
   [115 Procurement].[Inspection Required],
   [115 Procurement].[Actual Inspection Date],
   [115 Procurement].[Shipped Date (Vendor)],
   [115 Procurement].[Actual Delivery Date],
   [115 Procurement].[Delivering To?],
   [115 Procurement].[Delivery Required Date],
   [115 Procurement].[Promised Delivery Date],
   [115 Procurement].[Last Vendor Contact Date],
   [115 Procurement].Comments,
   [115_12 RFQ's].Commodity,
   [115_12 RFQ's].Buyers
FROM [115_12 RFQ's]
LEFT JOIN [115 Procurement]
   ON [115_12 RFQ's].ID = [115 Procurement].RFQ;

[115_12 RFQ's] .Buyers 正在返回我希望返回特定值的数字。

1 个答案:

答案 0 :(得分:1)

数据库中可能存在Buyers表,用于存储ID(现在是查询返回的内容)以及与ID关联的人员的姓名。 例如:

[Buyers table]
BuyerID
FullName

137   Tom Jones
138   Fred Smith

您需要做的是找出公开买家名称的表或视图的名称,并修改您的查询以执行到该表/视图的连接。从那里,您可以从表中包含买方的名称,而不是买方ID。

有些事情如下:

SELECT
   [115_12 RFQ's].RFQ, [115 Procurement].PO,
   [115 Procurement].[Issued Date],
   [115 Procurement].[C/O],
   [115 Procurement].Status,
   [115 Procurement].Vendor,
   [115_12 RFQ's].[RFQ Title],
   [115 Procurement].[PO Type],
   [115 Procurement].VDR,
   [115 Procurement].[Approval Drawings Required].Value,
   [115 Procurement].[Inspection Required],
   [115 Procurement].[Actual Inspection Date],
   [115 Procurement].[Shipped Date (Vendor)],
   [115 Procurement].[Actual Delivery Date],
   [115 Procurement].[Delivering To?],
   [115 Procurement].[Delivery Required Date],
   [115 Procurement].[Promised Delivery Date],
   [115 Procurement].[Last Vendor Contact Date],
   [115 Procurement].Comments,
   [115_12 RFQ's].Commodity,
   [115_12 RFQ's].Buyers,
   [Buyers].FullName
FROM [115_12 RFQ's]
LEFT JOIN [115 Procurement]
   ON [115_12 RFQ's].ID = [115 Procurement].RFQ
LEFT JOIN [Buyer] 
ON [115_12 RFQ's].Buyers = [Buyer].BuyerID;
相关问题