Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

", ' used in ODBC

I want to insert the value of a object(customer_no.Text) in order to replace the constant string 'abc' on the folowing code. When I type "customer_no.Text", the error prompts.
How to replace the constant?

Moreover, the datatype of the table field in database is X(8), the datatype of the compared value is string. Should I  change the datatype before comparsion? and How?


Thanks
Sub button_ok_Click()
   
    Application.Run "QueryGetData", "", _
        "SELECT customer.cust-num, customer.cust-seq FROM HFC.customer customer WHERE (customer.cust-num=" _
        , , , , , False
    Application.Run "QueryGetData", "", _
        "'ABC')" _
        , , , , , False
    Application.Run "QueryGetData", "DSN=styline;DB=HFC;OIDP=TCP;OIDS=symixoib;OIDH=rs6000;DBAM=Direct;DBPR=TCP;DBPA=/symdb/sl-db/live-db/;DBO=-RO;ASC=0;SR=1;GST=0;UID=;PWD=", _
        "", True, True, False, Range("Sheet1!$A$1"), True, False
End Sub
0
highfashion
Asked:
highfashion
1 Solution
 
fguerreiro_inixCommented:
>When I type "customer_no.Text", the error prompts.

Why don't you try:

Application.Run "QueryGetData", "","'" & customer_no.Text & "'"  

0
 
highfashionAuthor Commented:
Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now