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

Saving values in forms to tables

Status
Not open for further replies.

Dineedshelp

Technical User
Sep 27, 2002
44
GB
I have a text box within a field, the control source is formated to pull 4 different pieces of information from 4 different fields to produce something similar to the following:

001-001-0045-00565

The above field changes depending upon record number etc, and so no number is the same.

What I need to do is now save this info from the text box to a field in the table.

How can I do this?

[morning]
 
Just create another textbox CONTROL on the form and set the visible property to false as well as the TabStop property to false. You can squeeze it down small after you test the data exchange as it is only going to be the conduit to updating the underlying table for your form. This control should be bound to the table field that you want to update. Thus the control source should be the field in the table that you want to update with this created data value.

Since you already have a text box control with the cancatenation of multiple fields on the form for display we only need to create an expression to update this new control with the data from your display control in the AfterUpdate Event procedure of the form. For example purposes we shall call you display control me![DisplayValueControl] and the new control me![FieldNameControl].

Private Sub Form_AfterUpdate()
Me![FieldnameControl] = Me![DisplayValueControl]
End Sub

This code will only execute when the user goes to a new record and the DisplayValueControl has been changed. This will cause the new Bound control to be updated with the new value and the save operation will update the table.

I hope this works for you. Bob Scriver
 
Argh!!!

Its still not working!!!

I can see the value in the text box, but its still not updating the table.

I can see a swift drink coming on!!!

 
Okay. Which text box can you see the data being updated to? Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top