2008年8月12日 星期二

replace() 遇到NULL時發生錯誤

replace 遇到 Null 值時會發生錯誤,錯誤訊息:Null 的使用不正確: 'replace'


原程式碼:
out = out & replace(asrs.Fields(i).Value,","," ") & ","


改為:
If Not IsNull(as400rs.Fields(i).Value) Then
out = out & replace(asrs.Fields(i).Value,","," ") & ","
Else
out = out & " " & ","
End If

沒有留言: