0
sqlAddress = "SELECT " _
& "address_line_1, address_line_2, city, postcode, state " _
& "FROM contacts " _
& "WHERE (contact_id =" & contact_id & ")"
Set rsAddress = dbs.OpenRecordset(sqlAddress)
If Not rsAddress.EOF Then
addressStr = IIf(rsAddress("address_line_2")='', rsAddress("address_line_1") & Chr(13) + Chr(10) & rsAddress("city") & Chr(13) + Chr(10) & rsAddress("postcode") & Chr(13) + Chr(10) & rsAddress("state"), rsAddress("address_line_1") & Chr(13) + Chr(10) & rsAddress("address_line_2") & Chr(13) + Chr(10) & rsAddress("city") & Chr(13) + Chr(10) & rsAddress("postcode") & Chr(13) + Chr(10) & rsAddress("state"))
Me.vcTBAddress.SetFocus
Me.vcTBAddress = addressStr
End If
我想這做的是隻顯示的情況下,它不是空的address_line_2,它不是一個空字符串。 IIf正在返回語法錯誤。我看不出爲什麼 - 我錯過了什麼?
用rsAddress(「address_line_2」)=「」'替換rsAddress(「address_line_2」)='''' – Matt 2014-09-01 01:41:50