473,405 Members | 2,262 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,405 software developers and data experts.

Saving data from a form field to a table field

i have a field on a form where a calculation is displayed. The field calculates the number of business days a request is due based on a priority level chosen from a drop down box.

i want to save the data in the calculated field on the form to a new field in the table that i recently created to store this number.

how would could i have this data save to this field when the form is saved?
Nov 12 '08 #1
4 2023
Hi

use the 'after update' event of the combo to update the destination field. you could actually use that destination field on your form instead of the unbound box, and perform the calculation within vba.

example:

you could use the If ... then... end if method but I prefer to use select case for options like this, apparently it executes more quickly and in any case I find it easier to write


Expand|Select|Wrap|Line Numbers
  1. Private Sub ctlCombo_AfterUpdate()
  2.  
  3. select case me.ctlCombo
  4. case 1 'top priority
  5. me.txtField = me.txtField + 1 'where txtfield is a date and 1 is 1 day
  6.  
  7. case 2 'normal priority
  8. me.txtField = me.txtField + 7 
  9.  
  10. case 3 'low priority
  11. me.txtField = me.txtField + 28
  12.  
  13. end select
  14.  
  15. end sub

HTH
Kevin
Nov 12 '08 #2
missinglinq
3,532 Expert 2GB
While there are exceptions to the rule, in most cases calculated fields should not be stored in tables, and this is not a valid exception! Unless you expect the number of days that are assigned to Top, Normal and Low Priorities to change, the value should simply be re-calculated whenever it's needed, not stored in a table. Storage space aside, a calculation such as this will always be faster than retrieving data from disk.

Welcome to Bytes!

Linq ;0)>
Nov 13 '08 #3
Hi

use the 'after update' event of the combo to update the destination field. you could actually use that destination field on your form instead of the unbound box, and perform the calculation within vba.

example:

you could use the If ... then... end if method but I prefer to use select case for options like this, apparently it executes more quickly and in any case I find it easier to write


Expand|Select|Wrap|Line Numbers
  1. Private Sub ctlCombo_AfterUpdate()
  2.  
  3. select case me.ctlCombo
  4. case 1 'top priority
  5. me.txtField = me.txtField + 1 'where txtfield is a date and 1 is 1 day
  6.  
  7. case 2 'normal priority
  8. me.txtField = me.txtField + 7 
  9.  
  10. case 3 'low priority
  11. me.txtField = me.txtField + 28
  12.  
  13. end select
  14.  
  15. end sub

HTH
Kevin

The Calculation is not the issue, the issue is saving the number of days that is produced in to a field in the table. For example where "______" represents a text box.

Due In __5___ business days

i want to save the "5" in the table. how do i make the data save along with the rest of the record.

or rather how to i associate the field in the form to a field in the table?
Nov 13 '08 #4
While there are exceptions to the rule, in most cases calculated fields should not be stored in tables, and this is not a valid exception! Unless you expect the number of days that are assigned to Top, Normal and Low Priorities to change, the value should simply be re-calculated whenever it's needed, not stored in a table. Storage space aside, a calculation such as this will always be faster than retrieving data from disk.

Welcome to Bytes!

Linq ;0)>

The reason i want the form to store the data is because i am going to have to alter a report to calculate the number of days that the request actuall took to complete and compare it to the number that was required.
Nov 13 '08 #5

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

Similar topics

17
by: Jack | last post by:
Hi, This is a strange problem I am encountering. I have a asp page with a confirmation.asp page that saves data to a table. There are few text fields that are captured by the confirmation page as...
3
by: Eagle | last post by:
Hi all, I've constructed a database that handles data concerning the "flow" of tooling in a factory. The problem is in receiving back the concerned tools and storing this data in a table tbl_In....
0
by: dave | last post by:
In A2000 I have a table containing a memo field. There is an unbound form for entering text, and there can be lots of it. When the form opens there is a function to grab the data from the table and...
13
by: Stuart McGraw | last post by:
I haven't been able to figure this out and would appreciate some help... I have two tables, both with autonumber primary keys, and linked in a conventional master-child relationship. I've...
4
by: - | last post by:
I had added a new field to a form, and try insert the data to the new created table field. But when i try to assign the a control source for that form field, in the control source drop down list it...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
11
by: Kevin | last post by:
I've been searching forever for examples of saving data changes in a DataGridView. There's all kinds of examples, but none really show how to save changes. Someone please help me. I have a...
3
by: bettyboo | last post by:
Hi I'm new to the forum and also a VERY new user of Access to develop databases. I'm building a DB for a driving instructor acquaintance, and he wants a button on the pupil data entry form which...
1
by: AdamOnAccess | last post by:
I'm in Access 2007. I built a feature that to saves the current list in a sub form to a separate table. It works like this: After entering a list of words in the subform, the user can choose to push...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.