Results 1 to 4 of 4

Thread: Seach tables

  1. #1
    Join Date
    May 2003
    Location
    North Dakota, USA
    Posts
    8

    Unanswered: Seach tables

    Hello everyone i have a problem.

    i dont no if you can help but im sure you guys can. how would i say take a text box in vb and press a command button and make that command button get all the info for that specific partnum.

    i had :
    Code:
    Private Sub cmdGet_Click()
    
    If (txtGetRecord.Text = "") Then
    MsgBox "Must Enter A Connector Number Before Hitting Enter", vbCritical, "Error"
    Else
    Dim strGetRec As String
    txtGetRecord.Text = UCase(txtGetRecord.Text)
    strGetRec = txtGetRecord.Text
    
    dbInven.Recordset.FindFirst ("partnum = '" & strGetRec & "'")
    
    dbFAP.Recordset.FindFirst ("facpn = '" & strGetRec & "'")
    
    End If
    
    End Sub
    and it worked perfect when i was using an Access database but now that i am using postgresql it wont work. it says that the operation is not supported for this type of object. if possible please help with this question too.

    BIG K

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    you'll have to run an sql statement against the db.

    Code:
    Private Sub cmdGet_Click()
    
       If (txtGetRecord.Text = "") Then
          MsgBox "Must Enter A Connector Number Before Hitting Enter", vbCritical, "Error"
       Else
          Dim strGetRec As String
          Dim sql As String
          txtGetRecord.Text = UCase(txtGetRecord.Text)
          strGetRec = txtGetRecord.Text
    
          set sql = "SELECT * FROM tableName WHERE partnum = '" & strGetRec & "'" 'gets all matching records
    
          set sql = "SELECT * FROM tableName WHERE partnum = '" & strGetRec & "' LIMIT 1" ' gets the first matching record
    
          rs.open(sql, conn, 3, 3)
    
       End If
    
    End Sub

  3. #3
    Join Date
    May 2003
    Location
    North Dakota, USA
    Posts
    8
    what does the
    Code:
    rs.open(sql, conn, 3, 3)
    part do

    BIG K

  4. #4
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    recordset.Open Source, ActiveConnection, CursorType, LockType, Options

    the Source is the sql statement, the ActiveConnection is set to conn, the CursorType is 3 (which is adOpenStatic), lockType is 3 (adLockOptimistic).

    Source - Optional. A Variant that evaluates to a valid Command object, an SQL statement, a table name, a stored procedure call, a URL, or the name of a file or Stream object containing a persistently stored Recordset.

    ActiveConnection - Optional. Either a Variant that evaluates to a valid Connection object variable name, or a String that contains ConnectionString parameters.

    adOpenStatic - Uses a static cursor, which is a static copy of a set of records that you can use to find data or generate reports. Additions, changes, or deletions by other users are not visible.

    adLockOptimistic - Indicates optimistic locking, record by record. The provider uses optimistic locking, locking records only when you call the Update method.

Posting Permissions

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