Hi,
I'am looking for an alternative to manual change of variable ("Inspection Lot") within the script itself.
former sript:
Names Default To Here( 1 );
Open Database(
"DBQ=X:...
WHERE User1 LIKE '%Inspection Lot%'", "HSS"
);
I tried this - s.below, but it does not work. The script is running, but the "variable" was not used. Probably something is wrong with the format. Looking for advice.
Thank you.
new script version:
Names Default To Here( 1 );
win = New Window( "Edit Box - Enter the Inspection Lot",
<<Modal,
<<Return Result,
Text Box( "HSS Test: Enter the Inspection Lot" ),
texteditbox = TextEdit Box( "Inspection Lot" ),
Text Box( "Pressing OK - display of HSS graphs will be done automatically." ),
Button Box( "OK" ),
Button Box( "Cancel" )
);
Open Database(
"DBQ=X:...
WHERE User1 LIKE '%{"texteditbox"}%'", "HSS"
);
A few suggestions for posting in this forum:
On to your problem. My code checks to see if a value was entered into the text box. If there is a value there it creates a SQL string using the variable sql, and then calls Open Database. Your code calls open database with the IF command inside it. That won't work.
Try this code:
If( tbox_value != "",
sql = Eval Insert(
"SELECT TRBallShearHSBTTSF.Sample, Test, ....
FROM TRBallShearHSBTTSF INNER JOIN SSBallShearHSBTTSF
ON TRBallShearHSBTTSF.Sample = SSBallShearHSBTTSF.Sample
WHERE User1 LIKE '%^tbox_value^%'");
);
dsn_string = "DBQ=X:\- ...HS.mdb;DefaultDir=X:\- ...;Driver={Driver do Microsoft Access (*.mdb)};DriverId=..;FIL=MS Access;FILEDSN=X:\...dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;";
Open Database(dsn_string, sql, "HSS-Dage 4000");
);
You are calling the variable for your texteditbox "texteditbox", which is allowed but not good programming practice. Here's how to use the value entered in the textedit box:
Names Default To Here( 1 );
tbox_value = "";
win = New Window( "Edit Box - Enter the Inspection Lot",
<<Modal,
<<Return Result,
Text Box( "HSS Test: Enter the Inspection Lot" ),
tbox = Text Edit Box( "Inspection Lot" ),
Text Box( "Pressing OK - display of HSS graphs will be done automatically." ),
hlistbox(
Button Box( "OK",
tbox_value = tbox << get text()),
Button Box( "Cancel" )
)
);
if (tbox_value != "",
sql = evalinsert(
"SELECT foo, bar
FROM utopia
WHERE User1 LIKE '%{^tbox_value^}%'");
show(sql);
Open Database("DBQ=X:...", sql, "HSS");
);
If I enter ABC the log shows this:
sql = "SELECT foo, bar FROM utopia WHERE User1 LIKE '%{ABC}%'";
Hi,
thank you very much for your fast reply. Unfortunately I don't know much about programming and I'am still struggling - see below:
Sorry - I did not understand, where to put the "IF-Command".
Open Database(
"DBQ=X:\- ...HS.mdb;DefaultDir=X:\- ...;Driver={Driver do Microsoft Access (*.mdb)};DriverId=..;FIL=MS Access;FILEDSN=X:\...dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;",
If( tbox_value != "",
sql = Eval Insert(
"SELECT TRBallShearHSBTTSF.Sample, Test, ....
FROM TRBallShearHSBTTSF INNER JOIN SSBallShearHSBTTSF
ON TRBallShearHSBTTSF.Sample = SSBallShearHSBTTSF.Sample
WHERE User1 LIKE '%^tbox_value^%'",
"HSS-Dage 4000"
)
)
);
A few suggestions for posting in this forum:
On to your problem. My code checks to see if a value was entered into the text box. If there is a value there it creates a SQL string using the variable sql, and then calls Open Database. Your code calls open database with the IF command inside it. That won't work.
Try this code:
If( tbox_value != "",
sql = Eval Insert(
"SELECT TRBallShearHSBTTSF.Sample, Test, ....
FROM TRBallShearHSBTTSF INNER JOIN SSBallShearHSBTTSF
ON TRBallShearHSBTTSF.Sample = SSBallShearHSBTTSF.Sample
WHERE User1 LIKE '%^tbox_value^%'");
);
dsn_string = "DBQ=X:\- ...HS.mdb;DefaultDir=X:\- ...;Driver={Driver do Microsoft Access (*.mdb)};DriverId=..;FIL=MS Access;FILEDSN=X:\...dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;";
Open Database(dsn_string, sql, "HSS-Dage 4000");
);
Many, many thanks - my first dialog box works - I'am so happy!!! :-) :-)