I have a program that users use to conduct interviews. The most used form in the program is the interview form. This form will need to be opened in a variety of ways with a variety of information.
For instance, if the user is creating a new interview then I need to know if it is for one of our cases or for another court's cases. If it's for one of our cases, I need to run a query that gathers basic information and fill in a few questions. If it's for the other court, I don't need to fill in anything except the user, date and time.
Once the interview has been started, it may be paused while information is confirmed. Other interviews will be in progress at this time (so I need the capability to have multiple copies of the same form open with different information)
If the user is opening a completed or in progress interview, I will need to run a different query that gathers all the previously entered information and fill it in.
My original approach was something like this:
on main form, user selects 'New Interview':
when fInterview is shown:
The StartNew procedure:
the fNewInterview form has an edit box to enter the case number and a check box to indicate if it's for our court or another and button to start the interview process:
My problem is coming from the call to the NewInterview form. When the button is pressed after the user has entered the case number, the boolean value of booDistrict on the interview form isn't set.
So I need to be able to open an existing interview or a new interview. If it's a new interview I need to know if it's ours or theirs. When the main interview form closes I need all the information cleared out.
Am I approaching this the right way? Does anyone have any suggestions on how to make the program behave the way I need?
Leslie
Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
For instance, if the user is creating a new interview then I need to know if it is for one of our cases or for another court's cases. If it's for one of our cases, I need to run a query that gathers basic information and fill in a few questions. If it's for the other court, I don't need to fill in anything except the user, date and time.
Once the interview has been started, it may be paused while information is confirmed. Other interviews will be in progress at this time (so I need the capability to have multiple copies of the same form open with different information)
If the user is opening a completed or in progress interview, I will need to run a different query that gathers all the previously entered information and fill it in.
My original approach was something like this:
on main form, user selects 'New Interview':
Code:
procedure TfBIMain.NewInterview1Click(Sender: TObject);
begin
with TfInterview.Create(self) do
begin
booNewInterview := True;
Show;
end;
end;
when fInterview is shown:
Code:
procedure TfInterview.FormShow(Sender: TObject);
begin
if booNewInterview then
StartNew;
else
GetInterview(InterviewID);
end;
The StartNew procedure:
Code:
procedure TfInterview.StartNew();
begin
[b]//calls fNewInterview[/b]
fNewInterview.ShowModal;
if not booDistrict then
begin
with dm_Interview.qryGetCaseInfo do
begin
ParamByName('CasePrefix').AsString := sCasePre;
ParamByName('CaseNumber').AsString := sCaseNumber;
Active := True;
if not isempty then
begin
First;
//fill in information
end;
end;
end;
lCaseNumber.Caption := sCasePre + sCaseNumber;
lInterviewTimeStamp.caption := FormatDateTime('mm/dd/yyyy hh:mm am/pm', Now());
fNewInterview.Close;
end;
the fNewInterview form has an edit box to enter the case number and a check box to indicate if it's for our court or another and button to start the interview process:
Code:
procedure TfNewInterview.bBeginInterviewClick(Sender: TObject);
begin
fInterview.booDistrict := cbDistrict.Checked;
with dm_Interview.qryGetCaseInfo do
begin
fInterview.sCasePre := UpperCase(copy(eCaseNumber.Text, 1, 2));
fInterview.sCaseNumber := copy(eCaseNumber.Text, 3, length(eCaseNumber.Text));
end;
Close;
end;
My problem is coming from the call to the NewInterview form. When the button is pressed after the user has entered the case number, the boolean value of booDistrict on the interview form isn't set.
So I need to be able to open an existing interview or a new interview. If it's a new interview I need to know if it's ours or theirs. When the main interview form closes I need all the information cleared out.
Am I approaching this the right way? Does anyone have any suggestions on how to make the program behave the way I need?
Leslie
Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
Essential reading for anyone working with databases: The Fundamentals of Relational Database Design