How to Simulate the Clicking on the Form Header (1 Viewer)

JamesJoey

Registered User.
Local time
Today, 16:24
Joined
Dec 6, 2010
Messages
608
I have a split form with record id as the first column.
The id field 'Display as Hyperlink' set to screen only so when I click on it and editing form opens on that recotd.
On the OnClose of the editing form I requery the underlying form so the records are refreshed.
Problem is, and this is exclusively cosmetic, when the form closes and the underlying form is active the first row's
record ID field becomes selected. Just doesn't look right.
The ID field is enabled and locked.
I found though that if I click anywhere on the form's header the ID field gets unselected.
I've tried setting the focus to a button in the header but that didn't work.

Any way to prevent the field from getting highlighted like this?

James
 

CJ_London

Super Moderator
Staff member
Local time
Today, 21:24
Joined
Feb 19, 2013
Messages
16,606
should work, but split forms are a bit different (stuff happens under the hood over which you have no control) so may not work.

what event did you use to set the focus to the button?

Alternatively design your own split form - both forms based on the same recordset, ensure subform linkmaster/child properties are blank and in the subform current event put

parent.filter="PK=" & me.PK
parent.filteron=true

change PK to whatever your primary key is
 

JamesJoey

Registered User.
Local time
Today, 16:24
Joined
Dec 6, 2010
Messages
608
Actually I wasn't setting the focus to a button.
I created a unbound text box called txtDummy and set the height and width to 0.003.
In the on close of the editing form:
Code:
Forms!frmMySplitForm!txtDummy.SetFocus
 

CJ_London

Super Moderator
Staff member
Local time
Today, 21:24
Joined
Feb 19, 2013
Messages
16,606
thought that might be the case - as already mentioned, split forms are a bit different - the 'subform' is the main navigation control on the form but you have no real control over it other than it's position.

It might work if you set focus to one of the bound controls but since the 'subform' is effectively a datasheet view of the 'main form' recordset, I don't hold out much hope.

Recommend you create your own version as already described. It should only take a minute or two.

I don't use them because a) they are inefficient (whole datasets need to be loaded which is slow for large datasets) and b) I want my forms to be more dynamic.
 

isladogs

MVP / VIP
Local time
Today, 21:24
Joined
Jan 14, 2017
Messages
18,209
James
If you decide to follow earlier advice about creating your own version of the split form, you might find this example useful

The most recent version is in post #8 of that thread
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:24
Joined
Feb 19, 2002
Messages
43,213
Set the ID to
TabStop = No

You can still enter the control should you want to. Access just won't ever stop there by itself. Of course, focus will end up in the next available control. I'm not sure why specifically setting focus to a control after the Me.Requery isn't working for you. To set focus to a control, it must be visible. Could that be the problem? Make the text of this "dummy" control the same as the background of the form or the control so nothing typed there shows. Make the control as tiny as possible because you will still see the cursor. It will just be very tiny.
 

Users who are viewing this thread

Top Bottom