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

Storing tlbOne value in tblTwo 1

Status
Not open for further replies.

toddOne

Programmer
Jul 20, 2001
41
US
I have a form with a text box that has a control source from table1, and need to have this value assigned to another text box within the form that has a control source in table2. I have been trying to to asign the value of the text box during the on-open event, but keep receiveing an error. the error reads "can not assign a value to this object." can anyone help?
 
You can't move values on the On_Load event because during the On_Load event the fields havn't been filled with data yet. The sollution depends on what your trying to do, but one way is to set an After_Update event on the first textbox so that when you set something into it, the VBA code behind the event can easily place what you type into the box into the second text box.

If you want it to automatically load at form load you could try and see if this works. Use the On_Load to trigger the start of the On_Timer event, and give it a few seconds to finish loadin and then let the On_Timer event load the data. It would take a little fine tuning to make this seem seemless. You would probably also want to program it so that after the On_Timer event sets the field it will cease to repeat. I've never used this event so I can't give any details but it could be a good place to start playing.
 
Didn't my suggestion which i posted in ur previous thread...helped u in anyway?

Cheers!
Aqif
 
i didn't go the on_timer, route. i just hid some textboxes and was able to use them for calculations for other texboxes. thanks.
 
i want to supply default values from one table, and allow the user to manipulate this data and save changes in another, without changing the original default values.
 
So, the default value is based on another choice in a different field in the table? Otherwise, you could have a single default value assigned to the control. What triggers the default value assignment and what stipulates the criteria for defining which record to use as the default?
 
i have default values hidden on the form, from table1. the fields that are visible to the user are formatted with the same data, but can be manipulated and then stored with the record in table2. therefore the default values from table1 are never altered. is therea better way to do this?
 
If there is only one record in the 'default value' table then yes. Simply add the default value you want to the control's Default property.
 
You could always use "SetValue" where the value of the open form well post the the table2 AfterUpdate. Can be done via code or macro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top