Results 1 to 5 of 5

Thread: [RESOLVED] Why am I getting error on this statement

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    114

    Resolved [RESOLVED] Why am I getting error on this statement

    I have a flexgrid and db with a table called Person with a fields called PersonName, PersonID, and Title. What I am trying to do is when I click a button the only records I want to see are those with the Title "Dentist". I keep getting error right here.

    rs.Open "SELECT * FROM Person WHERE Title = ' Dentist ' ", cn, adOpenDynamic, adLockOptimistic

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Why am I getting error on this statement

    From what you've posted, every looks fine (other than the extra spaces in ' Dentist '. What is the error? What DB/Provider are you using.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    114

    Re: Why am I getting error on this statement

    Object variable or with block variable not set....

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,500

    Re: Why am I getting error on this statement

    An "Object variable" is one that isn't a simple data type (Integer/String/...), such as rs and cn in this case, so the error means that one of them (or maybe both) has not been Set properly before this code runs.

    This seems to be the same project as the other thread, so I'd guess that it would be rs (as cn is setup in form_load).

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    114

    Re: Why am I getting error on this statement

    I don't know what I did butit's working now. Thanks. Just wasn't sure my code was right.

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