PDA

Click to See Complete Forum and Search --> : Problems with string and integer


Nov 7th, 2000, 08:47 AM
Please take look:

if qry is string

Dim qry As String

adodc1.recordsource = "Select * from myfile where name = . . . .

if qry is integer

Dim qry As Integer

adodc1.recordsource = "Select * from myfile where codname = . . .

can someone complete the select

TIA

[Edited by JuanCarlos60 on 11-07-2000 at 09:55 AM]

paulw
Nov 7th, 2000, 09:07 AM
on your DBE, but generally they will take the form:

"SELECT .... WHERE name ='" & qry & "'" (Single quotes around the string

"SELECT .... WHERE name =" & Str(qry) (No quotes needed for an integer)

NB Str(qry) can be put as qry since it will cast to a string anyway, but Str() is more rigorous.

Cheers,

Paul.

jp_schwartz
Nov 7th, 2000, 09:11 AM
Iīm not sure whatīs your problem, but I guess that your question is about how to assign a value to a field in a query.

If thatīs the problem, in the string case your value must me between ''. ...where name='" & qry & "'...."

For numbers, you donīt need that....where codname=" & qry & ...

Nov 7th, 2000, 09:19 AM
Thank you very much guys!!! i love this forum