update table field from text box that gets its value from a combo

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have three fields on a form. One is a combo box and the other two are text
boxes that get their values based on a selection in the combo box. I need to
take the two text box values and use them to update two fields in a table and
I can't seem to figure out how to do this. Very new to programming and
database stuff. Any help is greatly appreciated.

Thanks
 
It will probably work better to start over with a copy of your form.

Put the form in design mode. Delete the existing combobox. Make sure the
Wizards are enabled (icon with the wand). Click the combobox on the toolbox
and draw the main window of the combobox on your form. The wizard will walk
you through the steps to set it up. Tell the wizard you're doing a record
operation and that you want to goto record. It will offer you the most
reasonable choices to do what you want in most cases. Put your from back in
run mode. Selecting a record in the combobox should take the form to that
record. If the record already has data in the fields on which the textboxes
are bound it will be displayed. If you change the data, it will be changed
in your tables when you leave the current record.

HTH
 
The combo box is bound to a field in the table already. What this is is an
Office Name address and then city state and zip. The combo box is the office
name which is bound to the table. The address is one text box and then city
state and zip are in the other textbox. The text boxes are not bound to
anything really unless you count the combo box because that is where they get
their values. Since the combo box is bound the table is updated with the
office name. I need to be able to update the table for the address and city
state zip from these "unbound" text boxes. When I try other means of changing
the combo box I keep getting unpredictable results with my text box values,
i.e. #Name. Is it possible to bind the three fields of the combo box to table
fields?

Thanks a million

Lance
 
I have three fields on a form. One is a combo box and the other two are text
boxes that get their values based on a selection in the combo box. I need to
take the two text box values and use them to update two fields in a table and
I can't seem to figure out how to do this. Very new to programming and
database stuff. Any help is greatly appreciated.

Thanks

Larry's got the best suggestion for the most likely scenario, where
you're trying to pull up an existing record for editing. But it may be
that you are trying to copy three fields from one table into a second
table, using the combo.

It's almost certain that you should NOT do this!

There is only rarely any reason to store data redundantly in this way.
For instance, if your three fields are EmployeeID, LastName and
FirstName, then the name information should be stored ONLY in the
employee table, and not copied into any other table.

Please post a description of what your two tables are, and what you're
trying to accomplish. If there is a valid reason to push three fields
from the combo's table into a second table, it is possible; but you
should not do so at all unless there is such a valid reason!

John W. Vinson[MVP]
 
Thanks for all the input guys. I really appreciate the help. I found a way to
do what I was trying to fo. Probably isn't the best way from a programming
standpoint but this is very small database and not many users. I simply added
two text boxes bound to the fields that I wanted to use to update the table.
Of course they are blank at this point. So I used the on AfterUpdate to set
the values of the bound text boxes to be equal to the value in the text boxes
that are tied to the combo box. I tested and it update the values in the
table as I need them and then I simply made the new text boxes not visible on
the form so that it appears transparent to the user. Again thank you all for
the help and I look forward to getting inout from everyone in the future.
Have a great day.

Lance
 
Back
Top