Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing a record from VBA (2000)

    I have a table with one record. the table is called Message

    The code below, is used elsewhere to read a record from within VBA, so I assume that the code below can be modified to write a record.?

    its just a simple string, no more records are required in the database.

    This is the code im using elsewhere to read a record.

    ------------------------------------------------------------------------------------------------------------
    Dim db As DAO.Database
    Dim snp As DAO.Recordset
    Dim msg As String, intLogoff As Integer

    Set db = CurrentDb
    Set snp = db.OpenRecordset("Settings", dbOpenSnapshot)
    intLogoff = snp![logoff]
    snp.Close
    db.Close
    ------------------------------------------------------------------------------------------------------------

    What i need to achieve, is to take a message that is in a string MyNewMessage = "Hello World"
    and exchange it for the single record in the table called "Message"

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing a record from VBA (2000)

    Using dbOpenSnapshot creates a read-only recordset. You need to use dbOpenDynaset if you want to change a value in the recordset.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing a record from VBA (2000)

    Thanks charlotte... all working now <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Changing a record from VBA (2000)

    Shouldn't that be 14 beers now?

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Changing a record from VBA (2000)

    Glasses, bottles or crates ?

Posting Permissions

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