Results 1 to 2 of 2

Thread: error 3709

  1. #1
    Join Date
    Feb 2004
    Location
    Bucharest
    Posts
    37

    Unanswered: error 3709

    Code:
     
    Dim sql As String
    nome = VBA.Left(cmbuser.Text, InStr(1, cmbuser.Text, " ", vbBinaryCompare))
    Set conn = New ADODB.Connection
    sql = "select nome from user where nome='" '" & VBA.Left(cmbuser.Text, InStr(1, cmbuser.Text, " ", vbBinaryCompare)) & "'"
    rs.Open sql, conn
    If Not rs.EOF Then
    cmbuser = rs!nome
    End If
    End Sub
    this code returns error 3709

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    You have to open the connection first, before it can be used. And, you need to Declare/Instanciate the recordset as well.
    Code:
    Dim Conn as ADODB.Connection
    Dim rs as ADODB.Recordset
    
    Set Conn = New ADODB.Connection
    Conn.Open "YourConnectionString"
    
    set rs = new ADODB.Recordset
    rs.Open SQL, cn
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

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