ComboBox populates text boxes, how to edit text now?

G

Guest

I have a form that has a combo box on it and also 8 unbound text boxes (I'm a
noobie to Access, so I really don't understand the "bound" vs. "unbound"
concept). When the form is opened, the text boxes are all blank/empty. For
some reason, the user cannot enter data into the text boxes. Data populates
the text boxes only after the user selects a record from the combo box, and
even then, the user cannot edit/modify the values. What I'm looking to do
with this form is:

1) Allow the user to enter data into the text boxes and have it save the
"new" record to a table.

2) Allow the user to select a record from the combo box, the selection will
populate in the text boxes, then the user could edit the values in the text
boxes and save/update the record by pressing the "Save" button.

3) Allow the user to select a record from the combo box, the selection will
populate in the text boxes, then the user could delete the record from the
table by clicking the "Delete" button.

I have gone through all the property options for the text boxes and could
not figure out how to do this. Please point me in the right direction and I
would be extremely greatful. Thanks for the help in advance...

DtF
 
G

Guest

Drew,

A bound control is bound to a field in the RecordSource of the form. When
data is entered in the control, the value is saved to the field in underlying
table. An unbound control is kind of like a "window" or "container" to
display a calculation or other helpful information.

Per table normalization rules, the only field that should be duplicated
between related tables is a foreign key on the many side that corresponds to
a primary key on the one side. For example, an Orders table would have a
CustID field to identify the customer placing the order. But the Name,
Address, etc. is stored ONLY in the Customer table. When these fields are
needed for display on a form, or printing in a report, a query joining the
two tables is created, or the fields are included as columns in a combo box,
and displayed by using the combo box' Column property.

Normally, the combo box would "hide" this foreign key in the dropdown list
by setting its ColumnWidth to 0", thus displaying more meaningful text in the
list and upon selection. Other columns are displayed by setting textboxes'
ControlSource to:

=YourComboBox.Column(x), where x is the column number, starting with zero.

What you're asking to do is to edit the one side record on a form designed
to enter data into the many side, analogous to editing a customer name or
address on a form designed to enter Orders. If you want to permit this
editing, this would require opening a form based on the one side to the
current record in dialog mode, allowing changes, and then requerying the
combo box in the OnClose event of the form so that the original form reflects
the changes made.


' Command button code to launch form based on one side
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "YourSecondForm"

stLinkCriteria = "[YourSecondFormPrimaryKey]=" & Me![YourCombo]
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria, , acDialog

' OnClose code of one side form
Forms!YourFirstFormName!YourComboBox.Requery

Hope that helps.
Sprinks
 

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