I have the identical tabel structure in different folders as follows
I am able to access the individual folders as follows
I am able to UpDate in the default folder with the following
My problem being that this updates the table in the default folder.
What am I missing in order to UpDate the appropriate folder instead of the default folder?
Anyone?
Code:
C:\h\StdAcc\GL \\ The default folder or I won't get the dmStdAcc.qryGL [b]Active[/b] Property set to [b]True[/b]
C:\h\StdAcc\[b]1[/b]\GL
C:\h\StdAcc\[b]2[/b]\GL
C:\h\StdAcc\[b]3[/b]\GL
I am able to access the individual folders as follows
Code:
var
qryname1,qryname2, qryname3
begin
with dmStdAcc.qryGL do
begin
if dmStdAcc.tblUsrTfrPNo.value = 1 then
qryname1 := ''C:\h\StdAcc\[b]1[/b]\GL'';
if dmStdAcc.tblUsrTfrPNo.value = 2 then
qryname1 := ''C:\h\StdAcc\[b]2[/b]\GL''';
qryname2 := 't1.PNo = t2.PNo';
qryname3 := 't1.GLNo';
SQL.Clear;
SQL.Add('SELECT *');
s:=format('FROM %s',[qryname1]);
SQL.Add (s);
s:=format('WHERE %s',[qryname2]);
SQL.Add (s);
s:=format('ORDER BY %s',[qryname3]);
SQL.Add (s);
Active := True;
I am able to UpDate in the default folder with the following
Code:
procedure TfrmGL.UpDateGL;
var
qryname1,qryname2, qryname3,qryname4, qryname5,qryname6 : string;
s : string;
i : integer;
sFields: string;
sUpdate: string;
sIns : string;
const
C_UPD = '%s = :%s';
begin
with dmStdAcc.updGL do
begin
for i := 0 to (dmStdAcc.qryGL.FieldCount - 1) do
if i = 0 then
begin
sFields := dmStdAcc.qryGL.Fields[i].FieldName;
sUpdate := sUpdate +',' + Format(C_UPD,
[dmStdAcc.qryGL.Fields[i].FieldName,
dmStdAcc.qryGL.Fields[i].FieldName]);
sIns := ':' + dmStdAcc.qryGL.Fields[i].FieldName;
end
else
begin
sFields := sFields + ', ' + dmStdAcc.qryGL.Fields[i].FieldName;
sUpdate := sUpdate +',' + Format(C_UPD,
[dmStdAcc.qryGL.Fields[i].FieldName,
dmStdAcc.qryGL.Fields[i].FieldName]);
sIns := sIns + ', :' + dmStdAcc.qryGL.Fields[i].FieldName;
end;
end;
end;
My problem being that this updates the table in the default folder.
What am I missing in order to UpDate the appropriate folder instead of the default folder?
Anyone?