Copy value from one field to another (1 Viewer)

nhorton79

Registered User.
Local time
Today, 15:04
Joined
Aug 17, 2015
Messages
147
Ok. This might have been asked or solved somewhere else but hoping that someone can tell me how to do it or point me in the right direction.

I have some subform (fsubItemInput) on another form (frmItem) which allow me to add multiple Inputs to a quoted Item

The background tables are:

tblItem
ItemName
ItemDescription

tblInput
InputID
InputName
InputCost

tblItemInput
ItemInputID
InputQty
InputCost
InputID_FK
ItemID_FK

There are a couple of other fields but hopefully this level of detail should suffice for my question.

When I add an Input to an Item, I would like the value of [tblInput].[InputCost] to be copied to [tblInputItemInput].[InputCost]

Before you ask, “why duplicate data?”. The reason is that for most costs the amount will stay the same, however I have some generic Inputs that will allow the user to change the cost in the form.

I currently have the control source of the textbox (txtInputCost) on the subform set to [tblInputItemInput].[InputCost] so that the value will be stored in that field, however I cannot get the initial value to show the value of [tblInput].[InputCost].

I have tried setting the default value to [tblInput].[InputCost], but that doesn’t work. I thought about using a DLookup() but can’t seem to get that to work either.

Any help would be greatly appreciated.

P.S. I am using Access 2007 for this.
 

nhorton79

Registered User.
Local time
Today, 15:04
Joined
Aug 17, 2015
Messages
147
Wow! Thank you pbaldy.

I ended up having the combobox pass the value to the textbox when creating the new item using a similar method to what your included in your link.

This has also given me some new ideas of easily accessing related data rather than just bringing in the foreign key and then doing a dlookup. Thanks
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 20:04
Joined
Aug 30, 2003
Messages
36,125
Happy to help!
 

Users who are viewing this thread

Top Bottom