Subform learning concerns

V

Victoria

hello
I'm a new coder who could use an assist. I don't know if its appropriate to
ask 2 questions in the same post, but here goes...

My subform has 3 textboxes in which data can be entered, and several locked
text boxes that contain calculated values based on the three unlocked ones.

a) After each entry, I want all the calculated values to be immediately
updated. Everything seems to work OK, but I'm wondering if I'm safer to
requery just to make sure all the updates are always made? Is this
necessary? If so, which control(s) get requeried? (the data entry one or the
calculated ones) I don't want to use Me!Requery because the subform seems to
always go back to the 1st record.

b) When I've entered data in the 3 textboxes then tab again, I want to
return to the first box of the same record. (for the check cycle) I could
only get this to work by using a .SetFocus in the 3rd box's OnExit. When I
don't do this, the same record shows on the subform, but its textboxes look
empty. If I move to a new record then come back, the records are still there
(they didn't dissapear after all). Whats 'goin on here? Is my .Setfocus
approach the right one?
 
R

Rick Brandt

Victoria said:
hello
I'm a new coder who could use an assist. I don't know if its
appropriate to ask 2 questions in the same post, but here goes...

My subform has 3 textboxes in which data can be entered, and several
locked text boxes that contain calculated values based on the three
unlocked ones.

a) After each entry, I want all the calculated values to be
immediately updated. Everything seems to work OK, but I'm wondering
if I'm safer to requery just to make sure all the updates are always
made? Is this necessary? If so, which control(s) get requeried?
(the data entry one or the calculated ones) I don't want to use
Me!Requery because the subform seems to always go back to the 1st
record.

You would requery the TextBoxes that have the calculation expressions.
b) When I've entered data in the 3 textboxes then tab again, I want
to return to the first box of the same record. (for the check cycle)
I could only get this to work by using a .SetFocus in the 3rd box's
OnExit. When I don't do this, the same record shows on the subform,
but its textboxes look empty. If I move to a new record then come
back, the records are still there (they didn't dissapear after all).
Whats 'goin on here? Is my .Setfocus approach the right one?

Set the Cycle property of the form to Current Record.
 
V

Victoria

Rick - thanks for your quick reply!

In the 2nd question, the Cycle property is super.

In the 1st question, I guess I was more interested in whether or not a
requiry is needed (or am I just being overcautious). Without the Requery,
all the calculated fields seem to be updating immediately after each change,
but is there any assurance that the Requiries are not actually needed? In
general, is it possible to state when records MAY need a requiry?
 
D

Damian S

Hi Victoria,

Any control that uses a recordset (combo box, listbox etc) will need a
requery if you are using another control on the form to filter the results.
Text boxes with a calculated field generally don't, but forcing one can't
hurt.

Damian.
 
R

Rick Brandt

Victoria said:
Rick - thanks for your quick reply!

In the 2nd question, the Cycle property is super.

In the 1st question, I guess I was more interested in whether or not a
requiry is needed (or am I just being overcautious). Without the
Requery, all the calculated fields seem to be updating immediately
after each change, but is there any assurance that the Requiries are
not actually needed? In general, is it possible to state when
records MAY need a requiry?

90% of the time a requery would not be required. I have seen some cases
though where I had to use it. Perhaps it is when other stuff is running
code. Updating the screen has a low priority in Access.
 

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