Hello all,
I am trying to use a Case statement to give me a correct value for my Address Lines in a report. The Report is based off a query and I am calling the Function I made from the query. When I run the query, it runs the function and opens the query but nothing seems to happen. I am really inexperienced at building functions and I thought I would post here to see what I am doing wrong.
Here is my function:
Option Compare Database
Option Explicit
Function AddressL2()
Dim Attn, ADL2, Dept, StreetAddress
Select Case Attn
Case Is <> Null
ADL2 = Attn
Case Is = Null
If Dept Is Not Null Then
ADL2 = Dept
End If
Case Else
ADL2 = StreetAddress
End Select
End Function
I am using a simplified vs. so that once I can get this correct, I can get everything else working. What it does is this. If Attn is filled, then I want ADL2 to be ATTN. If Dept is filled, but Attn is not, then I want ADL2 to be Dept. Other than that I want it to be Street1.
Any help is appreciated
Chris
I am trying to use a Case statement to give me a correct value for my Address Lines in a report. The Report is based off a query and I am calling the Function I made from the query. When I run the query, it runs the function and opens the query but nothing seems to happen. I am really inexperienced at building functions and I thought I would post here to see what I am doing wrong.
Here is my function:
Option Compare Database
Option Explicit
Function AddressL2()
Dim Attn, ADL2, Dept, StreetAddress
Select Case Attn
Case Is <> Null
ADL2 = Attn
Case Is = Null
If Dept Is Not Null Then
ADL2 = Dept
End If
Case Else
ADL2 = StreetAddress
End Select
End Function
I am using a simplified vs. so that once I can get this correct, I can get everything else working. What it does is this. If Attn is filled, then I want ADL2 to be ATTN. If Dept is filled, but Attn is not, then I want ADL2 to be Dept. Other than that I want it to be Street1.
Any help is appreciated
Chris