Results 1 to 5 of 5

Thread: adding record into database

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    9

    Post

    Okay, Ive recently learned how to make simple databases but I still can't figure out how to create an Add Button that will create a whole new record in my Access Database. Preferably i'd like the user to click the button and all the text fields on the screen become empty and the user can enter the new information into it. If anyone can help, please do. =)

  2. #2
    Member
    Join Date
    Jan 2000
    Location
    Singapore
    Posts
    59

    Post

    In the ADD button click event

    'clear all your text boxes
    text1.text = ""
    text2.text = ""
    and so on.
    or write a procedure to clear all the text boxes and call it



  3. #3
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284

    Post

    To clear the text boxes if you have them set up as an array

    For i = 0 to 9 'where you have 10 text boxes
    text(i) = ""
    Next

    Then when you are happy that the user has entered their data you can use a SQL insert statement to update your database, this statement could be behind a 'Save' command button.

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    9

    Post

    Actually, I was wondering if the Add button could clear all the fields (which has been mentioned how to solve) but instead of having to update the database after the information is entered, but just to have the fields automatically be the new record when you clicked the add button. That way the new record would already be there with nothing for data, which the user would then enter

  5. #5
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232

    Post

    if you're using DAO and datacontrol with bound textboxes, you can just invoke the addnew method of the recordest in the ADD button click event. All bound textboxes will be cleared and a new record is created, all automatically

    Code:
    private sub cmdAdd_click()
       data1.recordset.addnew
    end sub

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