L
Leslie Isaacs
Hello All
This is a continuation of a problem I posted last week.
I have a form with 6 unbound text boxes that show various calculated values
(using DLookups etc.). The only problem is that the values are not
displaying when the form is first opened: the only way I can get them to
display is either to click on them, or to tab through them.
I have tried using the following commands in the form's OnOpen event:
[text1].SetFocus
DoCmd.GoToControl ("[text1]")
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Following suggestions received to my earlier post, I have tried Me.Recalc in
both the form's OnLoad and its OnCurrent events, and I have also tried
Me.Repaint and DoEvents ... but unfortunately nothing worked!
I know that using the 6 DoCmd.GoToControl commands (1 for each textbox) does
work, because I put them as the OnClick event of a button, and that worked.
The problem is getting these events to 'fire' without having to click a
button.
The SetFocus and DoCmd.GoToControl commands both do work on the final
textbox specified - i.e. they cause the value in that final textbox to be
displayed: it's as if the commands haven't had time to
'act on' the previous texboxes though, as their values were not displayed. I
did try seperating the commands with a Beep command to see if that created
enough delay for the commands to 'act' on each textbox ... but it didn't!!
Finnaly, I tried just having 1 of the DoCmd.GoToControl commands in the
form's OnLoad event (i.e. DoCmd.GoToControl ("[weeklyrate]") ), and then
putting the other 5 in the OnGotFocus event of that first textbox
[weeklyrate], but it seems that you can't use code to go to a control that
has an OnFocus event!
What else can I do? There must be some way of getting the textboxes to
display their values without having to click a button or tab through them.
Hope someone can help.
Many thanks
Les
This is a continuation of a problem I posted last week.
I have a form with 6 unbound text boxes that show various calculated values
(using DLookups etc.). The only problem is that the values are not
displaying when the form is first opened: the only way I can get them to
display is either to click on them, or to tab through them.
I have tried using the following commands in the form's OnOpen event:
[text1].SetFocus
DoCmd.GoToControl ("[text1]")
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Following suggestions received to my earlier post, I have tried Me.Recalc in
both the form's OnLoad and its OnCurrent events, and I have also tried
Me.Repaint and DoEvents ... but unfortunately nothing worked!
I know that using the 6 DoCmd.GoToControl commands (1 for each textbox) does
work, because I put them as the OnClick event of a button, and that worked.
The problem is getting these events to 'fire' without having to click a
button.
The SetFocus and DoCmd.GoToControl commands both do work on the final
textbox specified - i.e. they cause the value in that final textbox to be
displayed: it's as if the commands haven't had time to
'act on' the previous texboxes though, as their values were not displayed. I
did try seperating the commands with a Beep command to see if that created
enough delay for the commands to 'act' on each textbox ... but it didn't!!
Finnaly, I tried just having 1 of the DoCmd.GoToControl commands in the
form's OnLoad event (i.e. DoCmd.GoToControl ("[weeklyrate]") ), and then
putting the other 5 in the OnGotFocus event of that first textbox
[weeklyrate], but it seems that you can't use code to go to a control that
has an OnFocus event!
What else can I do? There must be some way of getting the textboxes to
display their values without having to click a button or tab through them.
Hope someone can help.
Many thanks
Les