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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fill in multiple labels 1

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
I have a query that returns:

LastName, FirstName, JRTRSTatus

the Status is: Alt, J1, J2, - J6.

I have 7 labels on my form named:
lblJuror1
lblJuror2...
lblJuror6
lblJurorAlt

I want the caption of each label to be the First & Last Name of the query

So I have the following:
Code:
While not JMSData.qryTemp.EOF do
    if JMSdata.qryTemp.FieldByName('JMTRSTAT').AsString = 'Alt' then
      frmTrialInfo.lblJurorAlt.Caption :=
       ProperCase(JMSdata.qryTemp.FieldByName('FIRSTNAME').AsString) + ' ' +
       ProperCase(JMSdata.qryTemp.FieldByName('LASTNAME').AsString)
    else begin
      i := Copy(JMSData.qryTemp.FieldByName('JMTRSTAT').AsString, 1, 2);
      [COLOR=blue]frmTrialInfo.lblJuror + i.Caption :=
       ProperCase(JMSdata.qryTemp.FieldByName('FIRSTNAME').AsString) + ' ' +
       ProperCase(JMSdata.qryTemp.FieldByName('LASTNAME').AsString);[/color]
    end;

So I get the number from the JMTRStatus field and append to the labelname so that juror 1 is in the caption of lblJuror1, juror 2 in lblJuror2, etc. Any way I can do this?

Thanks!

Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
sorry for the bad formatting!
Code:
While not JMSData.qryTemp.EOF do
if JMSdata.qryTemp.FieldByName('JMTRSTAT').AsString = 'Alt' then
  frmTrialInfo.lblJurorAlt.Caption :=
   JMSdata.qryTemp.FieldByName('FIRSTNAME').AsString + ' ' +
   JMSdata.qryTemp.FieldByName('LASTNAME').AsString
else begin
  i := Copy(JMSData.qryTemp.FieldByName('JMTRSTAT').AsString, 1, 2);
  frmTrialInfo.lblJuror + i.Caption :=
  JMSdata.qryTemp.FieldByName('FIRSTNAME').AsString + ' ' 
 + JMSdata.qryTemp.FieldByName('LASTNAME').AsString;
end;
Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Maybe something like this:
var
LLabel:TLabel;

While not JMSData.qryTemp.EOF do
if JMSdata.qryTemp.FieldByName('JMTRSTAT').AsString = 'Alt' then
frmTrialInfo.lblJurorAlt.Caption :=
JMSdata.qryTemp.FieldByName('FIRSTNAME').AsString + ' ' +
JMSdata.qryTemp.FieldByName('LASTNAME').AsString
else begin
i := Copy(JMSData.qryTemp.FieldByName('JMTRSTAT').AsString, 1, 2);
LLabel := frmTrialInfo.FindComponent('lblJuror' + i);
LLabel.Caption :=
JMSdata.qryTemp.FieldByName('FIRSTNAME').AsString + ' '
+ JMSdata.qryTemp.FieldByName('LASTNAME').AsString;
end;
 
B - You Rock!! A star for you!!

I actually had to make the minor change below:

LLabel := TLabel(frmTrialInfo.FindComponent('lblJuror' + i));

But other than that minor change, it worked great!
Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top