Navigation Forms

JonnieMorgan

New member
Local time
Today, 11:36
Joined
Aug 7, 2021
Messages
6
Hi All, newbie question, forgive me for not searching the forum for this first but I’m unsure of the terminology!



I have a form there is a Form_Current event that sets the focus to a txt box:-

Forms!frmMedBrowser!FocustxtBox.SetFocus

This works fine, however when I put this form into a Navigation Form I get an error saying it cant find the form, so I’m thinking it might have something todo with the (excuse my terminology here) referencing of the object so I added:-

Forms!NavigationForm!frmMedBrowser!FocustxtBox.SetFocus to the statement.



But as you can guess that doesn’t work, would some kind person point me in the direction of the answer please?

TIA

Jon
 
Have to reference subforms through the subform container control. On regular form/subform arrangement I always name container different from object it holds, like ctrMed. When a Navigation Form is created, Access defaults with NavigationSubform, so try:

Forms!NavigationForm.NavigationSubform.Form.FocustxtBox.SetFocus

Access names the main form as Navigation Form - with a space. Did you change so space is removed?
 
Thank you. I see where I was wrong now! Not too far off was I! Yes I did delete the space.
Regards
Jon
 
If the "textbox" you want to setfocus is on the same form as the
current event:

just use Me.textbox.Setfocus, on the current event.
 
Even better, which leads me onto my next question. If I should start a new thread please tell me.
I have this FocusTxtBox on pretty much all my forms as it irritates me greatly otherwise. It would save me time if I could save and reuse the txtbox in other forms rather than creating a new one every time.

TIA
 
it can be done, but the problem is the placement of the textbox.
what is easier to do, is add a textbox and have a Class that
is reusable.
everytime Current event is triggered on the form, the textbox get focus.
 

Attachments

Right OK thanks for the example. I think for now I will plod on with old faithful and come back to that part later on in my learning.

Thank you for your answers.

Jon
 

Users who are viewing this thread

Back
Top Bottom