Results 1 to 4 of 4

Thread: Incomplete Query

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    43

    Post

    Can someone tell me why i keep getting error for this code? Thks.

    "Object variable or With variable not set"

    With Data3
    .RecordSource = "select * from " & LTrim(Text70.Text) & "'"
    .Recordset.MoveFirst
    .Refresh
    End With

  2. #2
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179

    Post

    the error is not in the query, but in the object you are using (Data3)

    First of all, you need to 'set' the object.

    I presume you did:
    dim Data3 as adodb.recordset

    Now you have to initialize it, by coding:
    set Data3 = new adodb.recordset

    You can do this right in this part of code, or in the form load event or somewere else.

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    if data3 is a db control, then make sure the databasename property is set. After assigning SQL to your recordsource, then refresh, then movefirst. You are moving first then refreshing. the SQL doesn't really execute until you issue a refresh command.

    HTH

    Tom

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    43

    Post

    Thks guys, for all your help.

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