Dan said:
Why am getting "Error 2185: You can't reference a property or method
for a control unless the control has the focus."? My code which is
saving changes simply has this reference, rsRatings("Rating") =
txtRating.Text.
Presumably the control named txtRating doesn't have the focus. Unlike a
VB text box, where the Text property is where the data in the control is
stored and is available at all times, an Access text box keeps its data
in the Value property. Although it has a Text property, that has only
specialized uses and is only available when the control has the focus.
By contrast, the Value property is available at all times and is the
property you should use for most purposes. Because the Value property
is the default property of an Access text box, you can write
rsRatings("Rating") = txtRating.Value
or
rsRatings("Rating") = txtRating
with equal validity. I prefer to prefix control names with the "Me"
qualifier, just to ensure no confusion can occur:
rsRatings("Rating") = Me.txtRating
However, that's not generally required.