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
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