select NavigationButton on NavigationControl with 3 level

leanpilar

Registered User.
Local time
Today, 21:59
Joined
Aug 13, 2015
Messages
94
On access 2013 I have 3 level on navigationcontrol
1st for the year. name: navigationcontrolyear
2015 2016 2017
2nd for the month. name: navigationcontrolmonth
01 02 03 04 05 06 07 08 09 10 11 12
3rd for the file with the same subform. name: navigationcontrololfile
01 02 03 04 05 06 07

the subform name on every 84/year navigationbutton is frmfilelookonly

I have a function for navigation where cause to get the correct ID from the selected tab of all 3 navigation control.

This is on a subform on a lot client form and I need on a current event from the main form to select the current month one, and later the 01 from the 3rd line because on the 11 (today) are no subform.

I have try .setfocus .tabs = month(date) .index
I read that docmd.navigateto is working but can't find a way
 
Thanks and sorry.
English is my 2nd foreign language and I use almost only for programming...
I did a small database to be more clear as suggested
it work only for 10 and 11 month because I entered record in orders only for this months.
As you can see when you change record on main form the selection don't change, and on open is always the 01.
i need to select the 01 of the 11
 

Attachments

thanks for your help.
it's a lot simple that you are looking for.
you was right: no class module and no macro...
if you open Frmorderrviewonly in design view and select 10 then 01 on 3rd row under proprieties data tab you can find the first row to select the form to show and where cause that is a simple filter where my function is.
that mean every time the form is load the function trigger because of the filter.
the 10 and the 11 doesn't call the function because they select the 01 in NavigationControorder under the NavigationControlMonth.
 
On my database i have from 1 to 7 and a total. Because 3/4 users need to read all "orders" of that client and only 1 need the other form for enter the data. And in our work never happened that we had more than 5/month because we have weekly orders...
 
No, never found nothing similar after a lot of googling
 
Code:
Private Sub Form_Current()
Dim mavcontrol As NavigationControl
Dim i As Integer, n As Integer
i = Month(Date)
Set mavcontrol = Me.Frmorderrviewonly.Form.Controls("NavigationControlmonth")
Me.Frmorderrviewonly.SetFocus
mavcontrol.SetFocus
For n = 1 To i
SendKeys "{TAB}", True
Next n
SendKeys "{ENTER}"
it's working but it's sad
 
Thank you for the help.
For now I have that code working and don't have time for that to much.
But it goes funny if on main form on load have me.recordset.gotolast
The code select 2016 and 09 :) but not 2015 and 11
 

Users who are viewing this thread

Back
Top Bottom