Solved

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

Posted on 2011-02-15
9
249 Views
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.
0
Comment
Question by:CindyDD
  • 3
  • 3
  • 3
9 Comments
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 200 total points
Comment Utility
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.

mx
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
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
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
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"?

JeffCoachman
0
 

Author Comment

by:CindyDD
Comment Utility
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.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:CindyDD
Comment Utility
They want to be able to look at sales in a particular week of one year compared to the same week in other years.
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
Do you need additional help then with the Before Update event ?

mx
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 300 total points
Comment Utility
"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?

JeffCoachman
0
 

Author Closing Comment

by:CindyDD
Comment Utility
Not exactly what I was looking for, but it works.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
ok
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now