Subform Current Record

calvinle

Registered User.
Local time
Today, 05:14
Joined
Sep 26, 2014
Messages
332
Hi,

I have a parent subform on a Form, and when I load the form, the current record in the subform is selected automatically. I have another subform which has the parent link to the Subform 1, and whenever I select a record in that Subform 1, it will cascade data in the subform 2, and the first record is selected.

Is there a way to remove that current record to be automatically selected by Access?

I want to click in the record of a subform to have it selected and not automatically selected.

Thanks
 
when the main form loads, shift focus (setfocus) to other control or textbox.
put an unbound textbox on the main form, set its width to 0, it backstyle to transparent, its borderstyle to transparent.

on your main form load event:

private sub form_load()
me.yourUnboundtextbox.setfocus
end sub
 
I have a parent subform on a Form, and when I load the form, the current record in the subform is selected automatically. I have another subform which has the parent link to the Subform 1,

Beware this structure.

Subforms always load before their mainform and AFAIK there is no way to absolutely control which subform loads first. An error will be thrown during the load if the child subform loads before the master subform.

In this structure I always use an intermediate textbox on the main form with its ControlSource pointing to the master subform then use that textbox as the MasterLinkField of the child subformcontrol.
 
when the main form loads, shift focus (setfocus) to other control or textbox.
put an unbound textbox on the main form, set its width to 0, it backstyle to transparent, its borderstyle to transparent.

on your main form load event:

private sub form_load()
me.yourUnboundtextbox.setfocus
end sub

And how about to not current select a record of the subform2 that is child link to the subform1?
 
then remove the link through code, then when you click on a control on subform1, or on enter envent of subform1 re-instate the link.
 
Lol.. I get it, but by removing the link, the record will not load inside isnt it?
OnCurrent then set Child Link then remove?
 

Users who are viewing this thread

Back
Top Bottom