Forms to Query several table columns, edit only one

  • Thread starter Thread starter Bob Kennedy
  • Start date Start date
B

Bob Kennedy

I would like to use a Form to query on the table key field, bring back the
contents of 3 other columns to assist user in confirming the correct record
has been retrieved, and then update a fifth column.

Bob Kennedy
 
Create a query that is based on the table (I'll call it TableName for now).
Put the desired fields on the grid. Under the table key field (the primary
key field), which I'll call PrimaryKeyFieldName, put this criterion
expression:
Forms!FormName!cboBoxName

(Replace FormName with the name of the form that you'll use, and cboBoxName
with the name of the combo box on that form that will be used to select the
primary key value.)

Base the form on the above query (set the form's recordsource to the query's
name). Put in the form's header the cboBoxName combo box. Set its RowSource
to this SQL statement:
SELECT PrimaryKeyFieldName FROM TableName ORDER BY
PrimaryKeyFieldName;

On the AfterUpdate event of the combo box, put this code:
Private Sub cboBoxName_AfterUpdate()
Me.Requery
End If

Put controls on the form that you then bind to the other fields in the
query. Include a control for the field that you want to allow the user to
update. If you don't want the "confirming" fields to be editable by the
user, then set their Enabled property to No.

Post back if you need additional help or have more questions.
 
I would like to use a Form to query on the table key field, bring back the
contents of 3 other columns to assist user in confirming the correct record
has been retrieved, and then update a fifth column.

Just set the Locked property to True and the Enabled property to False
on the three fields. Use the Combo Box Wizard to create a combo to
find the desired record using the key field.
 
Back
Top