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

Data Type

Status
Not open for further replies.

minoad

Programmer
Mar 28, 2001
138
US
sqltext = "Select * from Active_Patients Where number=('" & strname & "');"

Real dumb one, the above code is returning a 'Data Type Mismatch Error'. I am attempting to pass a number as a variable. Anyone see the error?

Micah A. Norman
 
sqltext = "Select * from Active_Patients Where number=('" & strname & "');"

should be...

sqltext = "Select * from Active_Patients Where number=(" & strname & ");"
 
let's try that again...
sqltext = "Select * from Active_Patients Where number=" & strname & ";"
That assumes strname is a number otherwise(for an integer)

sqltext = "Select * from Active_Patients Where number" & Cint(strname) & ";"

For a long - CLng(strname) etc..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top