Results 1 to 5 of 5

Thread: Simple Access Question II

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Trondheim, Norway
    Posts
    65
    I have a table with 1024 records.

    Register Value
    ----------------
    1 13
    2 1254
    3 4543
    4 135
    etc.--> 1024
    ----------------

    How the hell do I write a value to "Value" in a specific record when I know what record (e.g 1000) I want to write to?

    The only thing I've come up with, is MoveNext until I reach the desired record, but that's so slow!

    Please help me, gurus and semi-gurus!

    D

  2. #2
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    Use some SQL then create a recordset as follows

    Code:
    dim rs as New ADODB.Recordset
    
    sSQL = "SELECT * FROM [Your Table] WHERE [Your Field]=100;"
    
    rs.Open sSQL
    Hope this is of use
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Trondheim, Norway
    Posts
    65
    Hmmm...

    VB says:
    -----------------------------
    User-defined type not defined
    -----------------------------

    Dunnowattado!

    Thanks anyway, but could you explain it a little bit more in detail, please?

    D

  4. #4
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    Sorry Dragev
    This should explain it better.

    Make sure in your references you have the Microsoft AtiveX Data Objects Library 2.1 checked as well.


    Code:
            Dim cnn As ADODB.Connection
            Dim rs As ADODB.Recordset
            Dim sSQL As String
            
            'Open the connection to your database
            Set cnn = New ADODB.Connection
                With cnn
                    .Provider = "Microsoft.Jet.OLEDB.4.0"
                    .Open "C:\MyDB.mdb"
                End With
    
        'Enter your table name and field name where appropriate, also remeber to enclose the
        'value in "" if it is a string value
        'i.e. sSQL = "SELECT * FROM tblMain WHERE ID =1000;"
        sSQL = "SELECT * FROM [Your Table] WHERE [Your Field] =[Your value];"
    
        'Open the recordset based on the SQL string
        Set rs = New ADODB.Recordset
            With rs
                .CursorType = adOpenKeyset
                .LockType = adLockOptimistic
                .Open sSQL, cnn
            End With
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Trondheim, Norway
    Posts
    65

    Talking

    Thanks, man!
    Great!

    D

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