Mega Code Archive

 
Categories / Delphi / ADO Database
 

SQL and Quick Reports in combining fields

Title: SQL and Quick Reports in combining fields. dm is my data module qStudent is my Query dm.qStudent.SQL.Strings[0] := 'Select *, IIF(IsNull([Last Name]), '''', [Last Name] & '', '') & [First Name] & '' '' & [MiddleName] as RealName from Students'; What I am doing is replacing the first line of the SQL and selecting different information depending upon what a person clicked on. I have created this SQL so that I can get the fullname all together on a report. Example: If you dropped 3 fields onto a report [Last Name], [First Name] [D] - then it will most likeley output as Smith , Joe M. with all of the spacing. I then use this line of code to assign the DBlabel on my QuickReport. qrListAptForm.lblName.DataField := 'RealName'; Hope this helps someone, and if someone needs more information, just email me.