Samantha
still learning...
- Local time
- Today, 17:24
- Joined
- Jul 12, 2012
- Messages
- 187
I am trying to build an address string based off of my form. It has the following fields; ServiceAddress (FK), ID (PK), BillToCompany, BillCareOf, BillAttn, BillAddress, BillCity, BillingZip, BillBoxNumber.
What I would like to happen is the BillToCompany go on First and if that is blank I want it to populate with the string value of AddyLineVar and nothing else. Otherwise- following BillToCompany, I would like BillCareOf to follow on the next line skipping if it is blank, then BillAttn planning for nulls as well.
Currently if BillToCompany is blank then the code stops running. If there is a value in BillToCompany it proceeds almost how it should, it skips the BillCareOf & BillAttn.
Many Thanks for Looking!
Samantha
What I would like to happen is the BillToCompany go on First and if that is blank I want it to populate with the string value of AddyLineVar and nothing else. Otherwise- following BillToCompany, I would like BillCareOf to follow on the next line skipping if it is blank, then BillAttn planning for nulls as well.
Currently if BillToCompany is blank then the code stops running. If there is a value in BillToCompany it proceeds almost how it should, it skips the BillCareOf & BillAttn.
Code:
'Start building BillingAddress
If IsNull([Billing Information].Form![BillToCompany]) Then
BillingAddress = AddyLineVar
Else
BillingAddress = ([Billing Information].Form![BillToCompany])
'Add c/o on after Company.
If IsNull([Billing Information].Form![BillCareOf]) Then
AddyLineVar = AddyLineVar & vbCrLf & [Billing Information].Form![BillCareOf]
End If
'Add Attn on after Company.
If IsNull([Billing Information].Form![BillAttn]) Then
AddyLineVar = AddyLineVar & vbCrLf & [Billing Information].Form![BillAttn]
End If
'Add line break and Address lines.
BillingAddress = BillingAddress & vbCrLf & ([Billing Information].Form![BillAddress])
'Tack on line break then city, state, and zip.
BillingAddress = BillingAddress & vbCrLf & ([Billing Information].Form![BillCity]) & ", "
BillingAddress = BillingAddress & ([Billing Information].Form![State]) & " " & ([Billing Information].Form![BillingZip])
Many Thanks for Looking!
Samantha