This is a function i have written to align a series of addresses for printing labels.
However, for some reason the post code (A8) is not being moved up with the other address lines.
I can't for the life of me work out why. I need somebody with fresh eyes HELP!! - Function AddressLabels(ADD1, ADD2, ADD3, ADD4, ADD5, TOWN, COUNTRY, PCODE) As String
-
-
On Error GoTo AddressLabels_err
-
-
Dim A1, A2, A3, A4, A5, A6, A7, A8 As String
-
Dim i As Integer
-
-
A1 = ADD1
-
A2 = ADD2
-
A3 = ADD3
-
A4 = ADD4
-
A5 = ADD5
-
A6 = TOWN
-
A7 = COUNTRY
-
A8 = PCODE
-
-
For i = 1 To 7
-
-
If IsNull(A2) Then
-
A2 = A3
-
A3 = Null
-
Else
-
A2 = A2
-
A3 = A3
-
End If
-
-
If IsNull(A3) Then
-
A3 = A4
-
A4 = Null
-
Else
-
A3 = A3
-
A4 = A4
-
End If
-
-
If IsNull(A4) Then
-
A4 = A5
-
A5 = Null
-
Else
-
A4 = A4
-
A5 = A5
-
End If
-
-
If IsNull(A5) Then
-
A5 = A6
-
A6 = Null
-
Else
-
A5 = A5
-
A6 = A6
-
End If
-
-
If IsNull(A6) Then
-
A6 = A7
-
A7 = ""
-
Else
-
A6 = A6
-
A7 = A7
-
End If
-
-
If IsNull(A7) Then
-
A7 = A8
-
A8 = ""
-
Else
-
A7 = A7
-
A8 = A8
-
End If
-
-
Next i
-
-
AddressLabels = A1 & Chr(13) & Chr(10) & A2 & Chr(13) & Chr(10) & A3 & Chr(13) & Chr(10) & A4 & Chr(13) & Chr(10) & A5 & Chr(13) & Chr(10) & A6 & Chr(13) & Chr(10) & A7 & Chr(13) & Chr(10) & A8
-
-
Exit Function
-
-
AddressLabels_err:
-
AddressLabels = ""
-
Exit Function
-
-
End Function
I am running the function on an access report in a text box which has the following code: - =addresslabels([a1],[a2],[a3],[a4],[a5],[a6],[a7],[a8])
(a1 - a8 are the address fields supplied from an access query)
3 1407
This is a function i have written to align a series of addresses for printing labels.
However, for some reason the post code (A8) is not being moved up with the other address lines.
I can't for the life of me work out why. I need somebody with fresh eyes HELP!! - Function AddressLabels(ADD1, ADD2, ADD3, ADD4, ADD5, TOWN, COUNTRY, PCODE) As String
-
-
On Error GoTo AddressLabels_err
-
-
Dim A1, A2, A3, A4, A5, A6, A7, A8 As String
-
Dim i As Integer
-
-
A1 = ADD1
-
A2 = ADD2
-
A3 = ADD3
-
A4 = ADD4
-
A5 = ADD5
-
A6 = TOWN
-
A7 = COUNTRY
-
A8 = PCODE
-
-
For i = 1 To 7
-
-
If IsNull(A2) Then
-
A2 = A3
-
A3 = Null
-
Else
-
A2 = A2
-
A3 = A3
-
End If
-
-
If IsNull(A3) Then
-
A3 = A4
-
A4 = Null
-
Else
-
A3 = A3
-
A4 = A4
-
End If
-
-
If IsNull(A4) Then
-
A4 = A5
-
A5 = Null
-
Else
-
A4 = A4
-
A5 = A5
-
End If
-
-
If IsNull(A5) Then
-
A5 = A6
-
A6 = Null
-
Else
-
A5 = A5
-
A6 = A6
-
End If
-
-
If IsNull(A6) Then
-
A6 = A7
-
A7 = ""
-
Else
-
A6 = A6
-
A7 = A7
-
End If
-
-
If IsNull(A7) Then
-
A7 = A8
-
A8 = ""
-
Else
-
A7 = A7
-
A8 = A8
-
End If
-
-
Next i
-
-
AddressLabels = A1 & Chr(13) & Chr(10) & A2 & Chr(13) & Chr(10) & A3 & Chr(13) & Chr(10) & A4 & Chr(13) & Chr(10) & A5 & Chr(13) & Chr(10) & A6 & Chr(13) & Chr(10) & A7 & Chr(13) & Chr(10) & A8
-
-
Exit Function
-
-
AddressLabels_err:
-
AddressLabels = ""
-
Exit Function
-
-
End Function
I am running the function on an access report in a text box which has the following code: - =addresslabels([a1],[a2],[a3],[a4],[a5],[a6],[a7],[a8])
(a1 - a8 are the address fields supplied from an access query)
Hi
Would this be better - Function AddressLabels(ADD1, ADD2, ADD3, ADD4, ADD5, TOWN, COUNTRY, PCODE) As String
-
-
On Error GoTo AddressLabels_err
-
-
AddressLabels = ADD1
-
-
If ADD2 & "" <> "" Then AddressLabels = AddressLabels & Chr(13) & Chr(10) & ADD2
-
If ADD3 & "" <> "" Then AddressLabels = AddressLabels & Chr(13) & Chr(10) & ADD3
-
If ADD4 & "" <> "" Then AddressLabels = AddressLabels & Chr(13) & Chr(10) & ADD4
-
If ADD5 & "" <> "" Then AddressLabels = AddressLabels & Chr(13) & Chr(10) & ADD5
-
If TOWN & "" <> "" Then AddressLabels = AddressLabels & Chr(13) & Chr(10) & TOWN
-
If COUNTRY & "" <> "" Then AddressLabels = AddressLabels & Chr(13) & Chr(10) & COUNTRY
-
If PCODE & "" <> "" Then AddressLabels = AddressLabels & Chr(13) & Chr(10) & PCODE
-
-
Exit Function
-
-
AddressLabels_err:
-
AddressLabels = ""
-
Exit Function
-
-
End Function
??
MTB
QVeen72 1,445
Recognized Expert Top Contributor
Hi,
Change last part of your code: -
If IsNull(A6) Then
-
A6 = A7
-
A7 = Null
-
Else
-
A6 = A6
-
A7 = A7
-
End If
-
-
If IsNull(A7) Then
-
A7 = A8
-
A8 = Null
-
Else
-
A7 = A7
-
A8 = A8
-
End If
-
You are checking for Null, but Assigning a Blank String..
REgards
Veena
Cheers QVeen72, knew it would be something easy!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: JP SIngh |
last post by:
Hi All
I am trying to write a recursive function to list the managers and his
employees in a tree like sctructure
Manager 1
Emp1
Emp1.1
Emp 1.2
Emp 2
|
by: |
last post by:
Hello All, this is my first post.
OK - The goal is to display the following (note: substitute 1' ' for 2'*')
by using 3 recursive functions.
0123454321001234543210
**012343210012343210**
****01232100123210****
******0121001210******
********010010********
**********00**********
**********00**********
|
by: |
last post by:
OK:
Purpose: Using user's input and 3 recursive functions, construct an hour
glass figure. Main can only have user input, loops and function calls.
Recursive function 1 takes input and displays a sequence of spaces;
recursive function 2 uses input to display ascending sequence of digits;
likewise, recursive function 3 uses input to display descending sequence of
digits.
I have not followed the instructions completely regarding the...
|
by: Robert |
last post by:
Vb.Net Make dll that contain one function. Help Please.
I would like to call a function from different applications.
I think i have to make a dll.
I have Visual Basic.net 2003 Standard Edition, that teorically does
not make dll,
but pratically does.
I search vbc.exe and copy it to a new folder, in which i have the
|
by: Goldie |
last post by:
Can some please look at this function and maybe help me with why it's
not doing as it's told... :)
It's basicall meant to check to see if that field returned from
database actually has any data in it, and if not, return a display:none
style to hide it from the list
I'm trying to achieve not having to show every option of the columns in
that row, especially if the column is empty (no data)
| |
by: TC |
last post by:
IE only (V6).
First, I know very little JS and our resident expert is short on time,
so I come to you for help. I have a dynamic CGI script (written in
Progress) that generates the following HTML:
<input type="hidden" name="NoteText" id="NoteText" value="Test">
<a onclick="NoteText=prompt('Enter Note'); alert(NoteText);"
class=MENU href="priority-mail-cgi?Context-ID=cakvfDljlSpYCVac"
|
by: Abersparky |
last post by:
Can someone help me with the mail() function???
The below is just to get myself going but I can't seem to get it
working... is there something else I should be doing? I checked
phpinfo() and the sendmail values are below. Those mean it's turn on
right?
sendmail_from
me@localhost.com
sendmail_path
|
by: turtle |
last post by:
Background:
I have a table of fields each field representing a month (Jan, Feb,
Mar...). These are not a date field but more of a bucket to hold
labor actuals. Along with the months their is another field for
year. Looking at the table you can see which month and which year the
hours belong to but since the month buckets are not actual dates it is
hard to write certain criteria's that represent dates. I have linked
to a suppliers...
|
by: kang jia |
last post by:
hi
currently i am doing this search function for car booking website. it can search through either car seats or CarModel. it seems it able to do search function, however i small problem occurs to me. As i would also like to show the customer whether the car is available or not available. Basically it is car status at the moment. However, i am not sure how to do this. my ideas is that if car_inventory>0, show available, otherwise show Not...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |