Access 2007 Two controls will not save to the record source.

Posted on 2011-02-15
Last Modified: 2012-06-21
I have set the DataEntry property to YES.
I have set the recordsource for the form to the correct table. All controls show the same table.
Two controls-both of which are calculated fields, will not save to the table. I have gotten them to save once but something changed and now they will not save.
Question by:CindyDD
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 200 total points
ID: 34902604
Calculated controls do not automatically save to your table.

Generally not recommended to save calculated values, but if you really need to then you will need to set the values in the Form Before update event.

LVL 75
ID: 34902623
You can do that like this (EXAMPLE)

Private Sub Form_BeforeUpdate (Cancel As Integer)
    Me![Field1] = Me.txtCalcValue1
    Me![Field2] = Me.txtCalcValue2
    Me![Field3] = Me.txtCalcValue3
      ' and so on
End Sub
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34907660
But please note what MX mentioned above:

    "Generally not recommended to save calculated values,"

So even though this is possible, it is not recommended in most cases.

So can you take a step back and first explain the nature of these calculations, and explain why you feel that they should be "Stored"?

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.


Author Comment

ID: 34907676
Only one of them is important to save. It is a calculation showing the week of the year the purchase is made on. This is for forcasting sales etc.

Author Comment

ID: 34907685
They want to be able to look at sales in a particular week of one year compared to the same week in other years.
LVL 75
ID: 34908638
Do you need additional help then with the Before Update event ?

LVL 74

Accepted Solution

Jeffrey Coachman earned 300 total points
ID: 34909527
"a calculation showing the week of the year the purchase is made on"

As far as I can see, this data does not have to be stored, it can be "Derived" form the table data.
You can pull the "Week" out of the date.

If you store this data, and then the date changes, you will have to create a system to "re-store" the data.
By using a query to display the Week, none of this is required.
SELECT YourTable.TheDate, DatePart("ww",[TheDate]) AS TheWeek
FROM YourTable;

Am I missing something here?


Author Closing Comment

ID: 35319174
Not exactly what I was looking for, but it works.
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35320686

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question