#ERROR (1 Viewer)

Harry Taylor

Registered User.
Local time
Today, 20:37
Joined
Jul 10, 2012
Messages
73
Noob Question.
I have this control source in a text box;

=([Enquirymaster100 subform].[Form]![REF NO])

When the result is blank I get an #Error message.

How can I say if blank return blank?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:37
Joined
Oct 29, 2018
Messages
21,517
I think Excel has ISERROR() but not sure if Access does. Otherwise, you may have to use an IIf() statement.
 

Ranman256

Well-known member
Local time
Today, 15:37
Joined
Apr 9, 2015
Messages
4,337
I made a function similar to NZ, called NZB() Null to Blank

USAGE:
= NZB([Enquirymaster100 subform].[Form]![REF NO])

Code:
Public Function NZB(ByVal pvVal)
On Error Resume Next
Select Case True
   Case IsNull(pvVal)
        NzB = NZ(pvVal, "")
   Case Else
      NzB = pvVal
End Select
End Function
 

Josef P.

Well-known member
Local time
Today, 21:37
Joined
Feb 2, 2023
Messages
839
Rename the control (e. g. textbox) from [REF NO] to txtREFNO ... then the data access runs via the AccessField element.

=[Enquirymaster100 subform]![REF NO] => should work
=[Enquirymaster100 subform]![txtREFNO] => #Error
 

Users who are viewing this thread

Top Bottom