Share via

MS Access Forms, populate feilds from last record

Anonymous
2016-11-14T06:03:12+00:00

I am trying to create a form in Access 2013.  It's going to be used for data entry.  I would like to add a button with an embedded macro that the user can click to populate 17 of the 18 fields with the values from the most recently created record.  Some of the fields contain text and some contain numbers.  One of the fields (the key) is always going to require that the user enter a unique value.  I already have the button  in the form but I don't know how to program the associated macro. 

Application:  Access 2013

Table name: Batch

Form name: BatchForm

Thanks!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. ScottGem 68,830 Reputation points Volunteer Moderator
    2016-11-15T02:16:34+00:00

    Yes the equipment used is a separate entity. The piece of equipment and its attributes should be kept in a separate table. There should just be a foreign key field in the table you are entering data into that represents the piece of equipment. The batch info is then separate.

    Relational database tables should be tall and thin, not wide.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-11-15T01:58:01+00:00

    Thanks Scott,

    This is my first complex database, so it's likely that I have design issues.  I would very much appreciate your assessment.  The database I am making monitors batch production data of a manufacturing process.  The amount of data points per batch is large, probably 500 entries per batch.  I haven't decided if each batch should be represented by a table, or if each major process phase should be represented by a table. 

    This particular form (or rather a tab in a form) is to enter the equipment that runs the process for a batch or process phase.  The equipment doesn't change often per batch, but it can occasionally happen.  An example would be that a particular piece of equipment breaks down and we use it's back-up replacement.  That's why I wanted a "copy" function so that if the data entry associate knows we used the same equipment as the previous batch (99% of the time) than they can just press a button to populate those fields.

    Do you think I should being doing it differently?  Should "equipment for batch" be it's own table?

    I haven't tried your Append query solution yet, but I plan on implementing it this afternoon.  Thanks for you help!

    Brandon

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-11-14T12:24:17+00:00

    You'll find an example of how to electively carry forward values from a newly entered record, either in the current session of a form only, or in subsequent sessions also until cancelled, as Defaults.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to amend the form design accordingly.  

    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.

    However, as Scott points out, the fact that you are having to carry forward values in so many columns points to your table, in all probability, not being correctly normalized, and consequently at risk of update anomalies.

    Was this answer helpful?

    0 comments No comments
  4. ScottGem 68,830 Reputation points Volunteer Moderator
    2016-11-14T10:24:04+00:00

    If you are repeating so many values from record to record then its is likely that your database is not designed properly. One of the principles of a relational database is to reduce redundancy.

    I would suggest that you describe your application and the table behind your form and we can advise further.

    If you insist on doing this, just run an Append query.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2016-11-14T07:36:18+00:00

    Was this answer helpful?

    0 comments No comments