Results 1 to 5 of 5

Thread: Newbie question

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Nashville, TN
    Posts
    54
    Hello all. I have a simple qustion here. I have an access database call club.mdb

    Now I know this code here to set up the object:

    Set db = DBEngine.OpenDatabase("c:\club.mdb")
    Set rs = db.OpenRecordset("customers", dbOpenTable)

    I also know how i can read data from my databse like:
    d
    im var as string
    varid=rs.fields("ID")

    But how can I write to the database. I dont want to use the bound controls eother. I just want to change the first entry in the IF field

    thanks for any help

  2. #2
    Guest
    Use SQL.
    Code:
    INSERT INTO myTbl (field1, field2) VALUES ("myval1", "myval2");

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Nashville, TN
    Posts
    54
    Sorry for my ignorace, but im also very new to sql. Could you write the code more exact

    thanks again

  4. #4
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    SQL is always good, but you can write to the database using DAO with either AddNew/Update or Edit/Update.

    To add a new record:
    rs.Addnew
    ' Fill in data for each field
    rs!Field1 = "Whatever"
    rs!Field2 = "Whatever"
    ...
    rs!FieldX = "Whatever"
    rs.Update

    To update an existing record, you must first move to the record that you want, and then do the following:
    rs.Edit
    ' Fill in data for each field you want to change
    rs!Field1 = "Whatever"
    rs!Field2 = "Whatever"
    ...
    rs!FieldX = "Whatever"
    rs.Update
    "It's cold gin time again ..."

    Check out my website here.

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Nashville, TN
    Posts
    54
    How can i move to that field. I cant get the find first command to work with this.
    thanks for all the help

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