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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing a Value from a Form Back to a Table 1

Status
Not open for further replies.

Milin

Technical User
Jan 5, 2000
33
US
I bet this is an easy one, but I just need someone to help me understand the basic concept - I've never done this before...<br>
<br>
I have a form (form1 )and a subform(form2). When data is entered on form 1, a customer number (an autonumber) is generated. This number and the other data is then written back into form1's table when the record is saved. I have a subform within this form in which I want to have the info that is set up, linked back to form 1's customer number. I created a new textbox in form2 that calls the value of the customer number textbox from form 1 once its generated. This works. What I don't understand is that when both forms are saved, I want the customer number value in form 2 to be written back into a field I created for it in form 2's Table. I'm assuming I have to write some code that points a value back to a table and field? <br>
<br>
Thanks much
 
I probably break the rules when I do stuff like this but very often getting forms 'synchronized' can be a nusance!<br>
<br>
The record in the sub form does not come into existance until the user selects 'add' record, I assume.<br>
<br>
So, use the main forms 'OnCurrent' Event to store the 'CustomerNumber' in a global variable. Then when the user selects 'add' to create the record in the sub form copy the value of the global <font color=red>Me![CustomerNumber] = globalCustNum</font>. No add button? Then use the <b>Before Update</b> event procedure in the sub form to copy the value of the global variable containing the customer number to the <b>bound field </b> for customer number in the sub form. Either way when the user saves the record the customer number is stored (and displayed) in the sub forms recordset along with the rest of the forms contents. Set the property for the sub form field to 'locked' to keep life simple for everyone involved. :)<br>
<br>
<p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href=http:// jazz.adelphia.net> </a><br>Amiel
 
That was a useful new way of doing that that i have not considered before,&nbsp;&nbsp;- learn something new everyday <br>thanks Amiel<br> <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top