Macro to open form to a sepcific tab? (1 Viewer)

accessingaccess

Registered User.
Local time
Today, 03:51
Joined
Mar 2, 2019
Messages
11
Hi!


I have a form with three tabs. When I open this form in add mode, I would like it to default to a specific tab. I was hoping to achieve this with a macro. Is this possible? I can't figure it out...


I'm using Access 2016.


Thank you!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:51
Joined
Oct 29, 2018
Messages
21,357
Hi. I don't use macros much but try something like:
Code:
If [NewRecord]
  Set Property
    ControlName: TabControlName
    Property: Value
    Value: 2
Change 2 to which ever tab you want to assign. You may also have to start with zero (0).
 

Micron

AWF VIP
Local time
Today, 06:51
Joined
Oct 20, 2018
Messages
3,476
You could simply set focus to a control on the page and that page will be the active one when form opens. Probably doable wit a macro (I don't use them either so just guessing) but code would look like
Code:
Private Sub Form_Open(Cancel As Integer)

Me.NameOfControlHere.SetFocus

 End Sub
EDIT - forgot to mention that I didn't include a test for new record because how form is being opened wasn't specified. Could be OpenArgs or even a duplicate of a form that's just for editing or appending records (which isn't the best method) or some other undisclosed method.
 

Users who are viewing this thread

Top Bottom