Text boxes, set focus and ribbons

Magster

Registered User.
Local time
Today, 09:12
Joined
Jul 30, 2008
Messages
115
Hello all,

I have a modal dialog form that I use for filtering data for reports. On the form I have text fields where the user can enter a search value. I use ribbons in this application which uses the logic behind a button which I hide on the form to call the report (I followed an example in a book for ribbons and this is how they did it).

My problem is when a text box is clicked and a value is entered, and if I immediately click the ribbon, the text box value isn't available because I didn't set focus someplace else. If I enter the value in the text box, and then click off the text box to some other text box and then click my ribbon button, all works fine. Apparently clicking on the ribbon doesn't move the focus as clicking on a button on the form does.

I don't understand a lot about the different form types and their settings, but I think this may be part of my problem.

When I use the button on the form to call the report all is fine because I set focus to the button by clicking it.

I would certainly appreciate some ideas... thanks!
 
Hi

try using the command "DoCmd.RunCommand acCmdSaveRecord" before the call report


example

...
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "report name"
...
 
Thank you so much - that worked! :)

I started to have some problems with this fix - the command not being available. So I tried something different. I created a dummy text field on the form where I can move the focus to prior to calling the report in VBA. I set the border style to transparent, set Enable = Yes, and Locked = Yes.

When the user clicks the ribbon button it goes to the public print button click code where I set the focus to the dummy field thus moving the focus from the last field entered on the form. Works great.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom