unbound text box on form equal to value of column in drop down lis

G

Guest

I have two problems.

I have set up an unbound text box (material) on a form After the Update of a
combo box (cost) the material is the second column in the combo box. I know
that the columns start at 0. I am getting the correct material info in the
unbound box but when I MOVE OFF OF THE RECORD AND COME BACK THE INFO IS GONE.
Where do I need to do this so it holds the info in the material field.


Also I have a Comments box that is made up of info from other fields. For
example, the location & the material. therefore for the control source on
the form for the comments field I put =[location]&" "&[material]. However,
I would like this info to be stored back into the original table that the
form is based off of - but it is not showing up there- anyway to do this?
Also the material part does not show up in comments when move to new record
and back based on above paragraph issue.

Thanks for your help,
Barb
 
N

Nikos Yannacopoulos

Hey Babs,

This is a common one... you can use a control's Control Source property
to either bind it to a table field (so it's saved) or enter a formula /
expression so it "reads" data from another control (or controls), but it
can't do both at the same time! The solution is to use the Control
Source property to bind the control to a table field, and use a macro or
some simple VBA code to get it populated based on the contents of
another control; you also need an appropriate event to fire the macro or
code.
As an example, in your first case, you can use the Before Update or
After Update or On Change event of the cost combo box to fire the macro
/ code; if you use a macro, it should have a SetValue action with
arguments Item -> the name of the material text box (which is now bound
to the table field!), and Expression -> a reference to the cost combo
box, something like =cboCost.Column(1). If you use code, the code in the
event procedure would be something like:
Me.txtMaterial = Me.cboCost.Column(1)
(I hope my control name assumptions are evident).

Once you crack this, the second one should be no problem, you would judt
need to make your update macro / code fire on an appropriate event of
both the location and material controls, so the comment is updated
whenever either is changed.

HTH,
Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top