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

Setparam syntax

Status
Not open for further replies.

DBergkamp10

IS-IT--Management
May 31, 2002
95
CA
Hi, I want to do a setparam/requery but I seem to be going in circles with the syntax.

I have a string variable called LIN_TAX_CODE that I want to feed into a query called StmtHdl3 as criteria.

I seem to be running into difficult with type mismatches.

I have

Stmthdl3.setparam LIN_TAX_CODE, 1

Stmthdl3.requery

I think I have this all wrong.

Anyone familiar with this?

Thx in advance

Ivan
 


Hi,

The syntax for SetParam is:

the first argument is the Parameter TYPE and

the second argument is the Parameter VALUE.

So what is the value of LIN_TAX_CODE, which shoud be a valid TYPE?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi, thank you for answering.

LIN_TAX_CODE is a String variable.

I've tried

Stmthdl3.Setparam 1, LIN_TAX_CODE

and I get the message, the parameter set failed, did you forget to set the paramater type for this parameter number?

I have a wild card statment '%' in the query for what the related table would receive as a value, although I'm not sure if that is corect either, but it doesn't seem to like the ?

Thx

Ivan
 



Please post your code including the SQL string.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi - here is the SQL string.

StmtHdl3.Open "Select TAXDETL_SQL.pkg_id, TAXDETL_SQL.tax_cd, TAXDETL_SQL.tax_meth, TAXDETL_SQL.tax_pct, TAXDETL_SQL.frt_fg " & _
", TAXDETL_SQL.misc_chg_fg, TAXDETL_SQL.tax_amt, TAXDETL_SQL.min_tax_amt, TAXDETL_SQL.max_tax_amt, TAXDETL_SQL.apply_min_max, TAXDETL_SQL.base_tax_calc " & _
", TAXDETL_SQL.tax_txbl_fg From TAXDETL_SQL Where TAXDETL_SQL.pkg_id = 'AR' and TAXDETL_SQL.tax_cd = '%' "

The code is placed following another section:

StmtHdl3.SetParam 1, LIN_TAX_CODE

StmtHdl3.Requery

While Not StmtHdl3.EOF
NoOrders = NoOrders + 1
LIN_TAX_METHOD = StmtHdl3("TAXDETL_SQL.tax_meth")
LIN_PERCENT = StmtHdl3("TAXDETL_SQL.tax_pct")
TobTaxFlg = -1

Thank you for your help in advance.
 

Code:
with StmtHdl3
   .[b][highlight]SQL[/highlight][/b] = "Select TAXDETL_SQL.pkg_id, TAXDETL_SQL.tax_cd, TAXDETL_SQL.tax_meth, TAXDETL_SQL.tax_pct, TAXDETL_SQL.frt_fg " & _
  ", TAXDETL_SQL.misc_chg_fg, TAXDETL_SQL.tax_amt, TAXDETL_SQL.min_tax_amt, TAXDETL_SQL.max_tax_amt, TAXDETL_SQL.apply_min_max, TAXDETL_SQL.base_tax_calc " & _
  ", TAXDETL_SQL.tax_txbl_fg From TAXDETL_SQL Where TAXDETL_SQL.pkg_id = 'AR' and TAXDETL_SQL.tax_cd =[b][highlight]?[/highlight][/b]"

   .SetParam 1, LIN_TAX_CODE

   .Refresh    'this is where the query is executed

end with

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi,

Unfortunately I'm still getting the message:

"the parameter set failed, did you forget to set the paramater type for this parameter number?"

I'm wondering whether 1 is for an integer, 2 is for a string etc?

Thx

Ivan

 
heh. Figured it out. I have to put in:

Stmthdl3.addparam 1

first.

Thanks for your time though, much appreciated.

Regards,

Ivan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top