[AccessD] DoCmd.GotoControl shifts form?
Ryan W
wrwehler at gmail.com
Fri Mar 24 17:22:06 CDT 2023
Yeah I wish I could show more but I’d need to blur out some sensitive data and my screen recorder doesn’t have a way to do that.
The add button is a 4 step process.
1 screen.activeform.setfocus
2 docmd.gotocontrol “child1”
3 docmd.gotocontrol “topcontrol”
4 docmd.gotorecord ,,AddNew
Step 2 is where the form sort of jumps around, depending on window size and control sizes. I don’t think it’s usual to set the subform control itself in focus but I can’t jump to the top control without jumping to its parent control first. Which leads to:
For some reason gotorecord doesn’t add a new record if I try and just set focus on the top control ala:
forms!lrc!child1!topcontrol.setfocus
🤷
Most of the forms in the DB use the ribbon controls to add/delete/copy records in the same manner so changes to this code aren’t really in the cards
Sent from my iPhone
> On Mar 24, 2023, at 4:33 PM, Stuart McLachlan <stuart at lexacorp.com.pg> wrote:
>
> Without seeing at least the whole "Lab Review Checklist" form and preferable the whole
> Access application window it's pretty hard to tell what is happening.
>
> Also what is actually happening with the Add button. It is clearly more than just a
> Docmd.Goto.
>
> Link to a stripped down sample database showing it would be useful.
>
>
>> On 24 Mar 2023 at 12:08, Ryan W wrote:
>>
>> There's some sort of correlation between anchoring and using focusing
>> on a child subform (and then a control on that subform) to use
>> docmd.gotorecord,,acnewrec (in the case of add).
>>
>> It also happens with Forms!FormName!SubFormControlName.setfocus....
>>
>> If I tinker enough with the control sizes that anchor and stretch down
>> I can get it to stop dancing on me...
>>
>>> On Thu, Mar 23, 2023 at 2:42PM Ryan W <wrwehler at gmail.com> wrote:
>>>
>>> Has anyone had experience with DoCmd.GotoControl shifting the form
>>> around a little if the form isn't "Wide enough"? I have a popup
>>> that if it's just narrow enough to fit ALL the data, but
>>> docmd.gotocontrol will shift everything to the left a little bit
>>> (seen in this video)
>>>
>>> https://www.screencast.com/t/xvBhK3oCr
>>>
>>> If the form is slightly wider, this doesn't happen but makes the
>>> form look weird with empty space on the right (this is a popup form
>>> with a sizable edge I'm tinkering with for people to move it to a
>>> second monitor (which is vertical, thus more narrow).
>>>
>>> If you watch, my index on the left (blue rectangle) gets cut in half
>>> as it moves off view and so far the only fix is to close the form
>>> and re-open it.
>>>
>>> The GotoControl is part of the ADD/DELETE/COPY buttons on the ribbon
>>> and have been working well on maximized forms (can't repo it
>>> there)....
>>>
>>>
>>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> https://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
More information about the AccessD
mailing list