Results 1 to 4 of 4
  1. #1
    Join Date
    May 2014
    Posts
    2

    Unanswered: Linking Forms and tables with button objects

    Hello,

    I'm creating an expense tracker (for myself and some roommates.)

    My database has a master expense table and a form for expense entry. The main menu has a button to "input new expense" that opens the expense entry form. Once the form is filled out, I want to have an "update" button to update the expense table. Is there a vb code I can input to have the "update" button load the fields from the expense entry form into my expense table?
    Or is there an easier way for the form to link to the table?

    Thanks,

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    tables store data, forms and reports present views of data (and can be based on tables, queries or views)
    if you make a change to the data in a form and save those changes then automatically the underlying data (the table, query or view) reflects those chanegs. if the chanegs are not shown immediately then you may need to refresh the view.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1
    Its a question of bound and unbound forms. Bound forms are specifically driven by tables, and the underlying table is set in a "Form Design" property (data --> "record source").

    You can go with unbound forms, and use "Docmd.runsql( SQL statement--> "UPDATE....") on a button on a click event. . However, beware: Access undertakes certain operations automatically with bound tables. You have to compensate for these when using unbound forms. For example, you will have problems with "'" (as in John's).

    If the question is how to populate the expense form with one expense claim, use on a button "docmd.openform" with a "Where" clause. The "where" clause needs to point to the unique ID of the individual expense form.

    J Smith
    Aylmer, Quebec

  4. #4
    Join Date
    May 2014
    Posts
    2
    Thanks for your response. I think I grasp a little about what your suggesting.

    The form fields are unbound. So when the data is entered and the "submit" button is clicked on event I would use

    DoCmd.runsql(Update, Table "table name")?

    Is there something else I'm missing?

    Thanks,

Posting Permissions

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