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

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.
CindyDDAsked:
Who is Participating?
 
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
"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
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
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
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
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
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Jeffrey CoachmanMIS LiasonCommented:
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
 
CindyDDAuthor Commented:
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
 
CindyDDAuthor Commented:
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
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Do you need additional help then with the Before Update event ?

mx
0
 
CindyDDAuthor Commented:
Not exactly what I was looking for, but it works.
0
 
Jeffrey CoachmanMIS LiasonCommented:
ok
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.