[英]MS Access Subform with fields with #Error in form view
MS Access 2003. MS Access 2003。
I have a query behind a subform that has a sql statement like this: 我在一个子窗体的后面有一个类似sql语句的查询:
SELECT ClientTotalInvoiceLineItems.*
, CDate(GetWeekEnding([WeekEnding1],[WeekEnding2],[WeekEnding3],[WeekEnding4],[WeekEnding5],[WeekEnding6])) AS WeekEnding
, CapturedInvoices.EnteredInvoiceNo, IIf([forms]![frmClientTotalInvoices]![frmClientTotalInvoicesSub].[Form].[NewRecord]=True,0,Ccur([ContractingFeesSubtotal])) AS Subtotal
, CCur([GSTAmount]) AS GST, CCur([TotalDue]) AS Total
, IIf(IsNull([ctlCreated]),'',[ctlCreated] & ' by ' & [ctlCreatedBy]) AS Added
FROM ClientTotalInvoiceLineItems
INNER JOIN CapturedInvoices
ON ClientTotalInvoiceLineItems.ctlSourceID = CapturedInvoices.CapturedInvoicedID
ORDER BY CDate(GetWeekEnding([WeekEnding1],[WeekEnding2],[WeekEnding3],[WeekEnding4],[WeekEnding5],[WeekEnding6])) DESC;
When the form is on a new record I get #error in the fields starting with ccur. 当表单在新记录上时,在以ccur开头的字段中出现#error。
So as you can see I tried to put a Form.NewRecord expression on field to test it but now MSAccess crashes when I try view in form view. 如您所见,我尝试在字段上放置Form.NewRecord表达式以对其进行测试,但是现在当我尝试在窗体视图中查看时,MSAccess崩溃。
How can I get rid of those #error in the fields on a new record of a subform?? 如何摆脱子表单的新记录中字段中的那些#error?
Malcolm 马尔科姆
I know one possible error is that you haven't correctly nested the forms; 我知道一个可能的错误是您没有正确嵌套表格。
The main "container" form that it's on needs to be included in the statement like 它所包含的主要“容器”形式需要包含在以下语句中
[forms]![frmClientTotalInvoices]![frmClientTotalInvoicesSub].[Form].[NewRecord]
I'm assuming that frmClientTotalInvoices
is the largest container of the form. 我假设
frmClientTotalInvoices
是该窗体的最大容器。
有几种方法可以解决此问题,但是一种方法是先使子表单的记录源为空,然后在主表单的after insert事件中填写记录源。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.