Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Name Line in LAbels

Status
Not open for further replies.

Greaser

Technical User
Aug 1, 2001
84
CA
Hi,
I created mailing labels.
The user can opt to use the cantact's alias or not.
Not all contacts have an alias.
There are 3 name lines on the label:
NameOnly - holds the contact's First and Last name
NameWithSecond - holds the contact's First, Second and Last name
NameWithAlias - holds the contact's Alias and Last name

I use the visible property to select the appropriate line
Only one is visible at a time.
********************************
Function AliasNameFcn() As Integer

' Declare variables
Dim useAlias As Control
Dim nameOnlyLine As Control
Dim nameWithAliasLine As Control
Dim nameWithSecondLine As Control
Dim AliasName As Control
Dim SecondNAme As Control

' Give the variables a value
Set useAlias = Forms!reportPrintOptionsFrm!useAliasFrame
Set nameOnlyLine = Reports!allEnvelopesRpt!NameOnly
Set nameWithSecondLine = Reports!allEnvelopesRpt!NameWithSecond
Set nameWithAliasLine = Reports!allEnvelopesRpt!NameWithAlias
Set AliasName = Reports!allEnvelopesRpt!AliasName
Set SecondNAme = Reports!allEnvelopesRpt!SecondNAme


'The user decided to use the alias
If useAlias = 1 Then
If IsNull(AliasName) Then
If IsNull(SecondNAme) Then
nameOnlyLine.Visible = True
nameWithSecondLine.Visible = False
nameWithAliasLine.Visible = False
Else
nameOnlyLine.Visible = False
nameWithSecondLine.Visible = True
nameWithAliasLine.Visible = False
End If
Else
nameOnlyLine.Visible = False
nameWithSecondLine.Visible = False
nameWithAliasLine.Visible = True
End If
' The user decided to use the person's full name
Else
If IsNull(SecondNAme) Then
nameOnlyLine.Visible = True
nameWithSecondLine.Visible = False
nameWithAliasLine.Visible = False
Else
nameOnlyLine.Visible = False
nameWithSecondLine.Visible = True
nameWithAliasLine.Visible = False
End If
End If
End Function
**********************************
My question is: Where do I put this code?
If I use it "On Open", the whole report uses the conditions of the first record.
Am I taking the wrong approach to this problem?

Your help with this problem is appreciated.
Thanks,
John
 
put the code in the on_format event of the report. Maq B-)
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top