P
Paxton
Hi all,
Access 2000: I've created a custom function to display an address on a
form, suppressing blank lines. The code for the function is as
follows:
Function FormatAddress(line1 As String, line2 As String, line3 As
String, line4 As String, line5 As String, line6 As String) As String
Dim strOut As String
If Len(line1) > 0 Then strOut = line1 & vbCrLf
If Len(line2) > 0 Then strOut = strOut & line2 & vbCrLf
If Len(line3) > 0 Then strOut = strOut & line3 & vbCrLf
If Len(line4) > 0 Then strOut = strOut & line4 & vbCrLf
If Len(line5) > 0 Then strOut = strOut & line5 & vbCrLf
If Len(line6) > 0 Then strOut = strOut & line6
FormatAddress = strOut
End Function
I've saved this as module 1 in Modules.
On the form, I have put this as the value in a text box:
=FormatAddress([Address1],[Address2],[Address3],[Town],[CountyState],[Postcode])
but when I run the form, I get #Error where the address should be. Can
anyone see where I've gone wrong?
TIA
Paxton
Access 2000: I've created a custom function to display an address on a
form, suppressing blank lines. The code for the function is as
follows:
Function FormatAddress(line1 As String, line2 As String, line3 As
String, line4 As String, line5 As String, line6 As String) As String
Dim strOut As String
If Len(line1) > 0 Then strOut = line1 & vbCrLf
If Len(line2) > 0 Then strOut = strOut & line2 & vbCrLf
If Len(line3) > 0 Then strOut = strOut & line3 & vbCrLf
If Len(line4) > 0 Then strOut = strOut & line4 & vbCrLf
If Len(line5) > 0 Then strOut = strOut & line5 & vbCrLf
If Len(line6) > 0 Then strOut = strOut & line6
FormatAddress = strOut
End Function
I've saved this as module 1 in Modules.
On the form, I have put this as the value in a text box:
=FormatAddress([Address1],[Address2],[Address3],[Town],[CountyState],[Postcode])
but when I run the form, I get #Error where the address should be. Can
anyone see where I've gone wrong?
TIA
Paxton