Results 1 to 4 of 4

Thread: DB SElection Problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    254

    DB SElection Problem

    VB Code:
    1. strSerialNo = "2"
    2. set rsmulti = dbname2.OpenRecordSet("SELECT * FROM Phrase2 where SerialNo = " & strSerialNo & " ",dbOpenDynaset)

    can anyone tell me whats wrong with this function ? it cant work

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: DB SElection Problem

    It always helps to state what is going wrong rather than just stating it doesn't work.

    What happens when you run this? Are you getting an error? If so, what does the error say?

    It looks like you are using a string variable. Strings need to be encapsulated in single quotes when used in querys.
    VB Code:
    1. "SELECT * FROM Phrase2 where SerialNo = '" & strSerialNo & "' "

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    254

    Re: DB SElection Problem

    erm it got some errors like....data type mismatch in criteria expression

  4. #4
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: DB SElection Problem

    string variables should be specified within single quotes.

    Check it out:

    strSerialNo = "2"
    set rsmulti = dbname2.OpenRecordSet("SELECT * FROM Phrase2 where SerialNo = '" & strSerialNo & "' ",dbOpenDynaset)
    CS

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