Results 1 to 3 of 3

Thread: Join table Cannot get record set

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Join table Cannot get record set

    I would like to get the records when I type the number into the text1.text. Why I not record found? Field name PLot is a number data type

    Code:
    Set InfoRS = New ADODB.Recordset
           With InfoRS
            .ActiveConnection = conn
            .CursorType = adOpenStatic
            .LockType = adLockOptimistic
         
             .Open "SELECT pemilik.Plot,pemilik.Pemilik1,pemilik.Pemilik2,Tanah.[LUAS (Ha)],Tanah.KOMPARTMEN,Tanah.Blok,Tanah.[NAMA PROJEK],Tanah.Negeri FROM pemilik,tanah where pemilik.Plot = Tanah.Plot order by pemilik.plot asc"
           End With
             InfoRS.Open "SELECT pemilik.Plot,pemilik.Pemilik1,pemilik.Pemilik2,Tanah.[LUAS (Ha)],Tanah.KOMPARTMEN,Tanah.Blok,Tanah.[NAMA PROJEK],Tanah.Negeri FROM pemilik,tanah where pemilik.Plot = Tanah.Plot and pemilik.Plot = " & Text1.Text & ""
    
     With InfoRS
               
                Text2.Text = .Fields("Pemilik1").Value & ""
                Text3.Text = .Fields("Pemilik2").Value & ""
                Text19.Text = .Fields("LUAS (Ha)").Value & ""
                Combo6.Text = .Fields("NEGERI").Value & ""
                Combo7.Text = .Fields("KOMPARTMEN").Value
                Combo8.Text = .Fields("BLOK").Value & ""
                Combo9.Text = .Fields("NAMA PROJEK").Value & ""
          
            End With

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Join table Cannot get record set

    I see a .OPEN in the WITH STATEMENT.

    And then another .OPEN right after the END WITH.

    You code is all messed up - please clean it up.

    Then - at the same time - learn to step through code one-line at a time using common debugging techniques. When you do that you also utilize the IMMEDIATE window of the IDE to examine variables contents and such. You can also hover over variables in the code window and the tool tip will show there value.

    Learning these techniques will stop you from posting threads on the forum that you can easily fix yourself.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Join table Cannot get record set

    Code:
    common debugging techniques
    How to do that?

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