Form not displaying value set by code...

J

John Keith

Repaint sounded like exactly what I needed... but it does not work.

In a popup-modal form, the detail contains assignment history data and is
for display only. In the header section I have a couple of text boxes to set
an effective date and an assigned location, 2 command buttons: update and
cancel, that error check and then run SQL to insert a new assignment.

The problem I am having is that the effective date is set via a popup
calendar when directly clicking on a specific day of that calendar... the
code runs that sets the value of the txtHdrEffDate field, but the box remains
blank UNTIL the focus moves from that field. The same situation occurs when
a assignment location (picked from a combo box) populates the assignment and
a DLookup assigns the location text to a different field, the looked up
location name will not appear until focus moves.

I have tried the repaint method (to complete any control calculations) but
it does not work. Refresh and requery don't work either, but I didn't expect
them to since they deal with the record set. It's the unbound text boxes
that are not displaying their values timely enough, which is the issue.

Any ideas on what I need to do?
 
J

Jeanette Cunningham

Hi John,
I don't remember coming across this problem myself.
One thing to try is setting the focus to another control then back to the
control where you want the value to show.
When moving the focus via code, it is good practice to use On Error Resume
Next, as there are times when access will not be able to move the focus to
the required control.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

John Keith

I had already ended up using the setfocus method to get the results I needed.
Thanks for the tip about using on error resume next.

--
Regards,
John


Jeanette Cunningham said:
Hi John,
I don't remember coming across this problem myself.
One thing to try is setting the focus to another control then back to the
control where you want the value to show.
When moving the focus via code, it is good practice to use On Error Resume
Next, as there are times when access will not be able to move the focus to
the required control.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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