Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    1

    Unanswered: "Enter Data" command button that clears form after it's clicked

    I am new to using Access and I honestly don't have the first clue at what I am doing with coding command buttons.

    Here's what I have so far . . .

    I have two tables - "Goal Area/Service Level" and "Required Classes"
    The two tables share a relationship
    I have one Form - "Goal Area"
    The form contains all of the fields that can be found in the two tables.

    Here's what I want to do . . .
    I would like the information that the user inputs into the form, to be added to the tables only after a command button is clicked. After that, I would like it to automatically clear the form so that the user can enter information for another student and there will not be inaccurate information.

    Any assistance anyone could provide would be greatly appreciated.

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    Welcome to the forums!

    As a starting point (and assuming you have an unbound form), I would suggest looking into running an Append query. If you need help figuring out how to build and run a query from a command button, I would recommend looking at Martin Green's site, he has a six part lecture on VBA and SQL. After you build and run the query in the code, then you'd just need to clear the form; and if you need help on this, you might want to post what kind of controls you have, how you enter in the data, and basically define what "automatically clear the form" means.
    Me.Geek = True

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    At the most basic level, you should know that a bound form can only enter data into ONE table. Since you have a relationship between the two tables, I believe what you need is a mainform/subform. Should be easy once you've got that.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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