In Access, How do I update multiple text boxes without doing a SetFocus for each?

My Access applications has a "calculation" that runs on the press of a button.  The calculation updates about 15 text boxes on a split form.  I only way I have found to update each one form the code is to do a "SetFocus" right before I call the Me.txt....Text = "".

As one would expect, this implementation has a visual causes the causes the cursor to jump all over the screen and is disconcerting to the user.  

First, is there a way to update the fields without having to "SetFocus"?  
If not, is there a way to suspend the updating of the screen until all the fields are set and then forcing a "redisplay" or the like...?
LVL 1
BruceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeCommented:
Is it updating more than one record?  or just the record displayed in the "form" side of the split.

I tried using split forms once and was not happy with the way they were implemented so stopped doing so a long time ago.  Do you really need the split form?  A lot of times, when I need some form of datasheet and a data entry form to go with it, I will use a main form, with two subforms (one data sheet, one data entry).

This gives me the ability to select a record in the datasheet subform and display the data entry form associated with that record in the other subform.
0
Helen FeddemaCommented:
One approach would be to put a word (say, "Update") in the Tag property of each textbox that needs to be updated, then cycle through the controls on the form and requery only these controls.  Here is some sample code:
Public Sub CycleControls(frm As Access.Form)

   Dim ctl As Access.Control
   
On Error Resume Next

      For Each ctl In frm.Controls
         If ctl.Tag = "Update" Then
            ctl.Requery
         End If
      Next ctl
         
End Sub

Open in new window


Use the Me argument to run it from the form.  This code could be run from a command button or some event.
0
PatHartmanCommented:
The problem is that you are using the .Text property rather than the .Value property.  The .Text property of a control is only available when that control has the focus.  Change your reference to
Me.fld1
or
Me.fld1.Value

The .Value property is the default property of a control so you can omit it for brevity.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.