I need to let the user select the unique field(s) when they want to print
mailing labels.
The mailing labels report uses a query created through a user interfact -
generates an SQL string and creates a temp query.
My CustomerData table looks like this
CustomerDataID (Primary Key)
FName
LName
CompanyName
Address
Country
PostalCode
The problem occurs when the there are more then one person working in the same
company(Yes, not normalize enough).
My user needs to send mailers to "The IT Manager" to all
companies. Is there a query that can be done?
SELECT DISTINCT CompanyName, Address, Country, PostalCode FROM CustomerData
This query will not do, it may still contain duplicate CompanyName
Or should I remove the duplicates at Report level.
' The code below will skip to the next record if
' CompanyName = Previous CompanyName
' CompanyName have to be sorted for this code to work
' Line4 contains CompanyName
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Static PreviousLine4 As String
If Me!Line4 = PreviousLine4 Then
Beep
Me.NextRecord = True
Me.MoveLayout = False
Me.PrintSection = False
End If
PreviousLine4 = Me!Line4
End Sub
The solution at report level does not give the user much control.
Is there a better method?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
-- Andy
SELECT DISTINCT CompanyName, Address, Country, PostalCode FROM
CustomerData
returns more than 1 row.
The only explanation I can think of is that the way you input those 4
fields isn't consistent when multiple people work for the same company.
Perhaps a data cleanup is in order, then some edits to ensure data
corruption doesn't recur.
--
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://webhome.idirect.com/~djsteele/