Results 1 to 4 of 4

Thread: Problems with string and integer

  1. #1
    Guest

    Question

    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]

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008

    Angry Depends...

    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.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  3. #3
    Hyperactive Member
    Join Date
    Nov 2000
    Location
    Mexico City
    Posts
    306
    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 & ...


  4. #4
    Guest

    OK!!!

    Thank you very much guys!!! i love this forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width