Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving data to tables?!

Status
Not open for further replies.

cjmcfg

IS-IT--Management
May 21, 2007
26
US
I have a database which houses both an employee table(that has employee names, SS#, commission %, branch, etc) and another table that is used to enter loan information and the employee is selected that has assisted the customer. In a form I have a combo box referencing the employee table to bring forward Firstname, Lastname, branch, commision%, and SS#. From there i need to write all this data to a different table automatically dependent on the employee selected from the combo box. I used the =""&Employee.Column(1) function to call the data into text fields that i need written to table but it will not save any of the data in these fields or in fields below that calculate formulas such as yield and commission. How to do have the fields have into my tables?
 
Only controls bound to fields are automaticallay saved to the form's underlaying table(s).
So, a common way is to set the Value property of the calculated/derived control in the AfterUpdate event procedure(s) of the control(s) involved in the expression.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I know what you mean and where to find it but i have no clue on how to format the command to save to a specific field in the table...could you tell me or give me a resource that could?
 
You don't save directly to a specific field in the table but set the value of a control bound to this field.
i.e. the ControlSource property of the control is the name of the field instead of an expression.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
so...where do i put my expression/reference equation?
 
In the AfterUpdate event procedure of the relevant controls (or the BeforeUpdate event procedure of the form after the check of all the validation rules).

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
for any of my fields if i paste this

="" & Officer.Column(5)

into updateafter and change the control source back to its original value "SS#", "Commission%", etc it just gives me a blank field and posts nothing?
 
In the Officer's AfterUpdate event procedure (click the ellips (...)) put something like this:
Me![Firstname] = Me!Officer.Column(0)
Me![Lastname] = Me!Officer.Column(1)
Me![branch] = Me!Officer.Column(2)
Me![commision%] = Me!Officer.Column(3)
Me![SS#] = Me!Officer.Column(4)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Still no Value
Even when you choose a different officer in the combo ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
What is the SQL code of the RowSource property of the combo and the WHOLE code of its AfterUpdate event procedure ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
So you want to take all that information about the employee and store it in a different table? Why not just store the PK of the employee table in the second table as a FK?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top