Tab Control Help Wanted

B

Bob Dydd

Hi Everybody

I have a form with a 5 page Tab contol.

When I open the form, I would like it to be on the page I last looked
at when I previously open the form.

Regard and Thanks in advance

Smiley Bob
 
A

Allen Browne

Take a look at this article:
Return to the same record next time form is opened
at:
http://members.iinet.net.au/~allenbrowne/ser-18.html

It explains how to return to the same record next time the form opens. You
could use the same approach to store the Value of the tab control in a
table, and then set the value again in the Load event of the form.
 
D

Dirk Goldgar

Bob Dydd said:
Hi Everybody

I have a form with a 5 page Tab contol.

When I open the form, I would like it to be on the page I last looked
at when I previously open the form.

Regard and Thanks in advance

Smiley Bob

Then you're going to have to store that information somewhere. You
could have a table to store such configuration information, read from it
in the form's Open or Load event, and update it in the form's Unload or
Close event -- or you could create and use a private property of the
form. That last requires a bit more code -- let me know if you want to
go that way.

The page of the tab control that is currently displayed is available
(read/write) as the Value of the tab control itself. This value is
equal to the PageIndex property of the displayed page.
 
B

Bob Dydd

John Baker said:
There are probably a ton of ways to do this, but this is what I would do:

Forms have a Tag property whose only functionality is to store any extra
information you want about the form. On the OnClose event of the
form, store the name of the Page that has the focus in this property,
and on the OnOpen event retrieve it and set the focus to that page.

Hmm. Thanks for the answers people.

I don't want to use another table to store the info so, the tag
function looks most appropiate for what I'm trying to do. Problem is I
have never seen it used in any mdb before.

I have started to write the following "air code" for the form

Private Sub CmdExit_Click()
Forms!frmTransactionTaskList.tag = "TabCtlPages.Value = PageSold"
DoCmd.Close
End Sub
' This is to receive info on whatever the last page was I was looking
at

Private Sub Form_Open(Cancel As Integer)
' Some code to retrieve the code from the Tag and set the
' focus to the last page I was looking at.
End Sub

BTW what needs to go in Form>Properties> Tag

Thanks for giving this your attention.

Smiley Bob
 
A

Arno R

I don't want to use another table to store the info so, the tag
function looks most appropiate for what I'm trying to do. Problem is I

If you distribute an mde to your users they won't be able to store the tag property...
The table approach however can always be used.
I always use a local table for local user-settings


Arno R
 
R

Rick Brandt

Bob Dydd said:
John Baker <[email protected]> wrote in message

Hmm. Thanks for the answers people.

I don't want to use another table to store the info so, the tag
function looks most appropiate for what I'm trying to do. Problem is I
have never seen it used in any mdb before.

You actually can't use the Tag property because making a change that would
persist between uses of the form would require that you open the form in
design view to set the property. Setting it while in normal view would
only persist until the form was closed.

Use a table. The exact purpose of a table is to store data that needs to
persist. This is what databases use for storage so I fail to see why you
wouldn't want to use one. Many apps have tables that are used for odds and
ends such as this.
 
B

Bob Dydd

Dirk Goldgar said:
Then you're going to have to store that information somewhere. You
could have a table to store such configuration information, read from it
in the form's Open or Load event, and update it in the form's Unload or
Close event -- or you could create and use a private property of the
form. That last requires a bit more code -- let me know if you want to
go that way.

The page of the tab control that is currently displayed is available
(read/write) as the Value of the tab control itself. This value is
equal to the PageIndex property of the displayed page.

Hi All

Well, I Tried Tag properties but the property was not available once
the form had closed.

So, back to the drawing board. I guess it is going to have to be a
table (or maybe temp Table), to store the last used focus page.

This can then be retrieved by the open or load event, dunno which.

Any pointers to the industry standard way of doing this would be most
welcome.
Regards All Smiley Bob
 
D

Dirk Goldgar

Bob Dydd said:
Hi All

Well, I Tried Tag properties but the property was not available once
the form had closed.

So, back to the drawing board. I guess it is going to have to be a
table (or maybe temp Table), to store the last used focus page.

This can then be retrieved by the open or load event, dunno which.

Any pointers to the industry standard way of doing this would be most
welcome.
Regards All Smiley Bob

I don't know about the "industry standard", but as Rick Brandt said,
lots of applications have little tables of configuration info. Do you
have any specific questions about how to implement this?
 
B

Bob Dydd

Dirk Goldgar said:
I don't know about the "industry standard", but as Rick Brandt said,
lots of applications have little tables of configuration info. Do you
have any specific questions about how to implement this?

Thanks for your attention to my problem.

I was definately barking up the wrong tree with tag properties.

I took on board what you and others said about a table, and did it that way.

I learned a lot using Allen Browne's code, and with some juggling I made that work.

Once again thanks people.

Smiley Bob
 
Top