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

setting a value in a field of a form.

Status
Not open for further replies.

barny2006

MIS
Mar 30, 2006
521
US
hi,
i have a form in access (form_inv)that has an input box field (qty_on_hand_box). this field's data doesn't come from a table, and it's calculated. how would i set this value in the field.
i had a vba routine that when they pushed the update button to update other tables, i used this code:
val = some value .....
forms!frm_inv!qty_on_hand_box.value = val

i get an error message that i can't set the value of this field.

how would i get this to work?
any help is appreciated.

 
If the ControlSource property contains the right formula, either:
Forms!frm_inv!qty_on_hand_box.Requery
or:
Forms!frm_inv.Recalc

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
it didn't work.
i placed that statement on control source of the property for the qty_on_hand_box
the value didn't sho up after pressing the command button.
 
first off, do you have a valid reason for breaking normalization rules and storing a calculated value?

secondly, what is the record source of the form? If a query, is it an updateable query?


Leslie

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

Essential reading for anyone working with databases:
The Fundamentals of Relational Database Design
Understanding SQL Joi
 
The statements I suggested you wasn't formulas nor expressions for a ControlSource property, but VBA code ...
PHV said:
If the ControlSource property contains the right formula

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
ok, sorry for the confusion. here's the whole picture.
this form updates the inventory master after pushing the command button.
after pushing the command button, i updated the inventory master, and i like to put the value of qty on hand in this field.
in the event vba for command button, i put this code:

forms!frm_inv!qty_on_hand_box.value = qy_on_hand
and that's giving me and error that the value for this field can't be set.
sorry for the confusion.
 
What is the actual ControlSource of Forms!frm_inv!qty_on_hand_box ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
the form uses 2 tables: 1)tbl_trans, which all the other fields on the form are populated from and 2) tbl_master which is updated by the fields in the forms by pushing the command button. the data for frm_inv!qty_on_hand_box comes from this table. the table column name is qty_on_hand.
i just need to find a way to shove a value in this field. is it possible? like qty_on_hand_box = some value?
 
And still never answered my question:
What is the actual ControlSource of Forms!frm_inv!qty_on_hand_box ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
the controlsource of forms!frm_inv!qty_on_hand_box is empty.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top