A family of Microsoft relational database management systems designed for ease of use.
I have a string of code in the Control Source Property of textbox: txtHXRShellWall:
=DLookUp("[Shell Wall]","[tblSSPipeSizes]","[Pipe OD]=" & [cmbHXRShellOD] & " And [tblSSPipeSizes]![SS Schedule]='10S'")
Everything works fine if the user selects a choice from the dropdown list of combobox: cmbHXRShellOD. But I also want to allow the user to input a custom number in this combobox. If I do that, the Dlookup function returns a #Error in txtHXRShellWall because it cannot find the value in the Pipe OD field of table: tblSSPipeSizes. I would like the code to return a zero value ("") if the Dlookup returns an error.
IsError() just returns a boolean value if there is an error.
Just change your control source to this:
=Nz(DLookUp("[Shell Wall]","[tblSSPipeSizes]","[Pipe OD]=" & [cmbHXRShellOD] & " And [tblSSPipeSizes]![SS Schedule]='10S'"),"")
Bob Larson, Former Access MVP (2008-2010) http://www.btabdevelopment.com (free Access tools, tutorials, and samples)