“#Error†in new record of continuous subform

S

Seth

On a continuous form I have a text box with a DlookUp function as its control
source:

=DLookUp("[fldStdRefNum]","tblStdAmds","[fldStdID] =" &
[Forms]![frmTestRprts]![subTestRprtStds].[Form]![txtHiddenStd])


However, the last (new) record displays “#Errorâ€. I think it returns
“#Error†because txtHiddenStd is Null.

I have tried something like IIF(IsNull(DlookUp(…)), DlookUp(…), “ â€) but
haven’t had any luck

Thanks for any help.

Seth
 
A

Allen Browne

Use Nz() to provide a value for the null text box, e.g.:

=DLookUp("[fldStdRefNum]","tblStdAmds","[fldStdID] =" &
Nz([Forms]![frmTestRprts]![subTestRprtStds].[Form]![txtHiddenStd],0))
 
S

Seth

Thanks.

Allen Browne said:
Use Nz() to provide a value for the null text box, e.g.:

=DLookUp("[fldStdRefNum]","tblStdAmds","[fldStdID] =" &
Nz([Forms]![frmTestRprts]![subTestRprtStds].[Form]![txtHiddenStd],0))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Seth said:
On a continuous form I have a text box with a DlookUp function as its
control
source:

=DLookUp("[fldStdRefNum]","tblStdAmds","[fldStdID] =" &
[Forms]![frmTestRprts]![subTestRprtStds].[Form]![txtHiddenStd])


However, the last (new) record displays "#Error". I think it returns
"#Error" because txtHiddenStd is Null.

I have tried something like IIF(IsNull(DlookUp(.)), DlookUp(.), " ") but
haven't had any luck

Thanks for any help.

Seth
 
Top