473,394 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Forms not updating tables

Using this string in forms control source "=DateSerial(year([StartDate]), month([StartDate])+6, day([StartDate]))". Works correctly in the the form, but does not update the fields in the table. New to Access -- any help would be appreciated. Thanks in advance.
Jan 15 '07 #1
24 4570
MMcCarthy
14,534 Expert Mod 8TB
Using this string in forms control source "=DateSerial(year([StartDate]), month([StartDate])+6, day([StartDate]))". Works correctly in the the form, but does not update the fields in the table. New to Access -- any help would be appreciated. Thanks in advance.
By putting that in a textboxes control source you are not storing it anywhere. The control source should be set to the field. Put the calculation in the default value and it will set the field to the correct value when the form opens.
Jan 15 '07 #2
Thanks for the quick reply - I will try that this morning and let you know how it turns out.
Jan 16 '07 #3
Mac, Tried entering the string into the default value box -- still no change/update to the table fields. I must have a bracket upside down or something. I'll keep working with it. Think of any other suggestions please let me know.
Jan 16 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
Mac, Tried entering the string into the default value box -- still no change/update to the table fields. I must have a bracket upside down or something. I'll keep working with it. Think of any other suggestions please let me know.
Did you also set the control source to the appropriate field?

This default value will only trigger when you open the form to the appropriate record.
Jan 16 '07 #5
The control source is set to the default field where I'm adding the string to the default value. Should it be set to another field? Thanks for your patience.
Jan 16 '07 #6
MMcCarthy
14,534 Expert Mod 8TB
The control source is set to the default field where I'm adding the string to the default value. Should it be set to another field? Thanks for your patience.
I don't really understand what you're saying.

Set the Control Source to the field in the table or query that you want to store the value in and set the default value to the previously mentioned statement. These are two separate properties.
Jan 16 '07 #7
Mac, I created a form using the info listed below from a Microsoft site. I changed the control source value for "futuredate" to futuredate. Also added the DatesSerial string to the default value as you prescribe. I can't figure out what I'm doing wrong. Again thanks for your help.

(Microsoft Site) ---- In Access, you can calculate a future or past date from a starting date by using an expression. For example, you can enter a date in a control on a form and calculate a date that is six months in the future from the original date. This article demonstrates this technique by using the DateSerial function to calculate the future date in the controls on a form. The calculated date can then be used in other calculations.

To calculate a future date by using the DateSerial function

In the Database window, click Forms under Objects, and then click New.
In the New Form dialog box, click Design View, and then click OK.
Using the Text Box tool in the toolbox, add two unbound text boxes to your form.
Set the Name property for one text box to StartDate and the other to FutureDate.
Set the Format property for the StartDate text box to Short Date.
Set the Control Source property for the FutureDate text box to the following expression: =DateSerial(year([StartDate]), month([StartDate])+6, day([StartDate]))


Switch to Form view.
In the StartDate text box, type a date (mm/dd/yy), and then press the TAB key.
The value displayed in the FutureDate text box is six months after the date in the StartDate text box.
Inserting a plus (+) followed by a number after the year, month, or day in the appropriate part of the function calculates a date that number of units in the future. Inserting a minus (-) followed by a number in the appropriate part of the function calculates a date that number of units in the past.
Jan 17 '07 #8
MMcCarthy
14,534 Expert Mod 8TB
(Microsoft Site) ---- In Access, you can calculate a future or past date from a starting date by using an expression. For example, you can enter a date in a control on a form and calculate a date that is six months in the future from the original date. This article demonstrates this technique by using the DateSerial function to calculate the future date in the controls on a form. The calculated date can then be used in other calculations.

To calculate a future date by using the DateSerial function

In the Database window, click Forms under Objects, and then click New.
In the New Form dialog box, click Design View, and then click OK.
Using the Text Box tool in the toolbox, add two unbound text boxes to your form.
Set the Name property for one text box to StartDate and the other to FutureDate.
Set the Format property for the StartDate text box to Short Date.
Set the Control Source property for the FutureDate text box to the following expression: =DateSerial(year([StartDate]), month([StartDate])+6, day([StartDate]))


Switch to Form view.
In the StartDate text box, type a date (mm/dd/yy), and then press the TAB key.
The value displayed in the FutureDate text box is six months after the date in the StartDate text box.
Inserting a plus (+) followed by a number after the year, month, or day in the appropriate part of the function calculates a date that number of units in the future. Inserting a minus (-) followed by a number in the appropriate part of the function calculates a date that number of units in the past.
What you have here will work fine but it doesn't store the FutureDate anywhere.

Mac, I created a form using the info listed below from a Microsoft site. I changed the control source value for "futuredate" to futuredate. Also added the DatesSerial string to the default value as you prescribe. I can't figure out what I'm doing wrong. Again thanks for your help.
What is showing in the FutureDate textbox. Is it the correct value?
Jan 17 '07 #9
FutureDate Textbox has "Futuredate".
Jan 17 '07 #10
MMcCarthy
14,534 Expert Mod 8TB
FutureDate Textbox has "Futuredate".
OK, open the properties window for the FutureDate textbox and click the dropdown box beside the Control Source property. Is futuredate a field on the list?
Jan 17 '07 #11
Yes, and I have it as the selected field
Jan 17 '07 #12
MMcCarthy
14,534 Expert Mod 8TB
Yes, and I have it as the selected field
Then I don't understand why the value is not being stored in the field. If you close the form and open the table to the same record is the value still not stored there?
Jan 17 '07 #13
Yes, after closing the form, the table field for "Futuredate" has not been updated/changed, in fact it is blank. Table field for "StartDate"is doing what it is suppose to do. Still baffled by this somewhat simple procedure.
Jan 17 '07 #14
MMcCarthy
14,534 Expert Mod 8TB
So the calculated value of futuredate shows on the form but doesn't get stored in the table?

Mary
Jan 17 '07 #15
Yes, that is correct. I have just about given up on this. Can't figure out what the problem could be. I have deleted the database and created new, just to see if that made a difference. The current (test) database at this point only has the table and form for three fields -- ID, Startdate, and Futuredate. Dave
Jan 17 '07 #16
MMcCarthy
14,534 Expert Mod 8TB
Yes, that is correct. I have just about given up on this. Can't figure out what the problem could be. I have deleted the database and created new, just to see if that made a difference. The current (test) database at this point only has the table and form for three fields -- ID, Startdate, and Futuredate. Dave
Can you try to attach the test database to your last post Dave. If you click the Edit/Delete link it should give you the option.

Mary

BTW, post a reply once it's done so I'll know.
Jan 17 '07 #17
Mary - here's the "Test" database -- good luck -- Dave
Jan 17 '07 #18
Well I'll try it again with a zip file.
Attached Files
File Type: zip test.zip (25.3 KB, 143 views)
Jan 17 '07 #19
MMcCarthy
14,534 Expert Mod 8TB
Well I'll try it again with a zip file.
What version of Access are you using and why have you got an accdb extension on the file.

Mary
Jan 18 '07 #20
That would be 2007 Beta -- free trial and download -- had the same problem with version 2000 that I was using previuosly. I guess Microsoft has gone to a new extension for the databases.
Jan 18 '07 #21
MMcCarthy
14,534 Expert Mod 8TB
That would be 2007 Beta -- free trial and download -- had the same problem with version 2000 that I was using previuosly. I guess Microsoft has gone to a new extension for the databases.
OK, I haven't gotten that version so can't open the file. Can you try to convert the database to previous version. Normally an option under the Tools menu probably in Utilities.
Jan 18 '07 #22
Sorry! Here you go. Dave
Attached Files
File Type: zip test2.zip (12.2 KB, 156 views)
Jan 18 '07 #23
MMcCarthy
14,534 Expert Mod 8TB
OK Dave the default value will only work with new records not on existing ones. I've removed the code from there and added to simple vba event procedures one of which will run if the start date is changed or a new startdate is added and the other of which will run when the form record is opened which will work for all existing records.

Mary
Attached Files
File Type: zip test2_Rev.zip (21.3 KB, 169 views)
Jan 18 '07 #24
Thanks Mary, When I opened the rev database in 2007 -- it didn't show the form ob ject -- only the table. I will try it in another computer with earlier version of Access. Thanks again, Dave
Jan 18 '07 #25

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: cwbp17 | last post by:
Have two tables that have a FK relationship on ID column. Have one datagrid that displays all of the columns of both tables. What's the best approach on updating a row from the datagrid back to...
4
by: Mark Lees | last post by:
I've built a simple DB and I'm having my users test it at a different location running on a single workstation. Mean while I'm making changes to the forms and reports on my workstation. How do I...
2
by: RC | last post by:
I am updating/improving a working database for a non-profit organization. I am thinking of making a copy of the database at the office, bringing the copy to my house, making the changes and then...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
4
by: Joey Powell | last post by:
Hello all. For a long time now I have been struggling with a .net Windows Forms problem. In several of my applications, I use the "Process" class from System.Diagnostics to accomplish various task...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
0
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
11
by: elaina | last post by:
Hi all. I am a complete newbie to Access. I've created a set of forms with nested subforms which while lovely (Yay me), are completely non-functional (boo). There seem to be 2 problems, but I...
2
by: Luting | last post by:
Hi, Is it possible to update oracle via Access forms? I am thinking maybe I could make a link table connnected with oracle database. And the form could be based on the link table. Does this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.