The change event fires on each keystroke, so it is not the one where you
want this code. Try the code in the AfterUpdate event... that means a
selection has been made by the user.
I don't understand what you mean by "updating everything in the form". The
code you show seems to me to update just the value currently displayed in
Text13 (though if I am right in my recollection, it would update it multiple
times, some with only partial data entered in the Combo).
Are you using a continuous forms view Form with multiple records displayed
and all the records are updated? If so, is Text13 an unbound Text Box? If
so, then that's the way unbound controls work in continuous forms view:
there is really only one detail section, and the other records that are
shown are just painted on the screen if they are bound. But an unbound
control, is changed in every visible copy whenever it is changed in the
currently selected record.
Larry Linson
Microsoft Access MVP
"Andy Frank" <an********@udig.com> wrote in message
news:cb**************************@posting.google.c om...
I have a tabular form that has a combo box on it that is reading from
a database. When that combobox changes, I want it to lookup a database
record to get a value and set the value into another text field on the
same form and record. Everything works fine except for that the change
event updates everything on the form not just the current recordset
that I am in and where the change event was started. Here is my code
any help is appreciated. I am small business owner and doing this for
a management report so my gentle with my coding approach.
Private Sub activity_type_Change()
Dim cnn As ADODB.Connection
Dim strSQL As String
Dim rs As ADODB.Recordset
Set cnn = CurrentProject.Connection
strSQL = "SELECT activity_point FROM activitytype WHERE
activitytype_id = " + Me.activity_type
Set rs = cnn.Execute(strSQL)
Me.Text13.Value = rs(0).Value
End Sub