Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Location
    Guelph, Canada
    Posts
    39

    Unanswered: Tab control question

    I have a Tab control with 3 pages.
    Currently I have the following code when I move from page0 to page1:

    If Me.TabCtl0 = 1 Then
    Me.frmStudRec.Form.Combo7 = Me.Det60sub.Form.Student

    I would like to add the following code to kick in when I move from page2 to page1:

    If Me.TabCtl0 = 1 Then
    Me.frmStudRec.Form.Combo7 = Me.TeachRecordQrySub.Form.Student

    How can I make Access know that I am coming from page0 to page1 or from page2 to oage1 and use the correct code as a result?

    TIA Eric

  2. #2
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243

    Re: Tab control question

    Originally posted by Noops
    I have a Tab control with 3 pages.
    Currently I have the following code when I move from page0 to page1:

    If Me.TabCtl0 = 1 Then
    Me.frmStudRec.Form.Combo7 = Me.Det60sub.Form.Student

    I would like to add the following code to kick in when I move from page2 to page1:

    If Me.TabCtl0 = 1 Then
    Me.frmStudRec.Form.Combo7 = Me.TeachRecordQrySub.Form.Student

    How can I make Access know that I am coming from page0 to page1 or from page2 to oage1 and use the correct code as a result?

    TIA Eric
    Write a procedure and give the name of the ta you're coming from as a parameter.

    Code:
    Private Sub yourProcedureName (tabnameYou'reComingFrom as String)
       Select Case True
          Case tabnameYou'reComingFrom = Me.TabCtl0.Name : 
              'Do whatever you want if coming from tab0
          Case tabnameYou'reComingFrom = Me.TabCtl1.Name : 
              'Do whatever you want if coming from tab1
          ....
       End Select
    End Sub

  3. #3
    Join Date
    Jan 2003
    Location
    Guelph, Canada
    Posts
    39
    Thanks Artemide for your reply!

    It looks like your solution might work, if I can understand it better.

    Private Sub yourProcedureName (tabnameYou'reComingFrom as String)

    Would I put something like:
    Private Sub NewProcedure (MyTab as String)

    A couple of things I'm not clear on here. If I name a new procedure, how will it kick in? I already have an OnChange event. Do I merge the two? Also, I only have *one* TabName for the form, it's TabCtl0.
    This tab has three pages, Page0, Page1 and Page2.

    Select Case True
    Case tabnameYou'reComingFrom = Me.TabCtl0.Name :
    'Do whatever you want if coming from tab0

    Would I put something like:

    Select Case True
    Case MyTab = Me.TabCtl0.Page0 :
    'Do whatever you want from page0?

    Case MyTab = Me.TabCtl0.Page2 :
    'Do whatever you want if coming from page2?
    ....
    End Select
    End Sub


    And how do I tie in the important reference code that I need:

    If Me.TabCtl0 = 1 Then
    Me.frmStudRec.Form.Combo7 = Me.Det60sub.Form.Student

    If you could explain this a little more in detail I'd really appreciate it!

    TIA Eric

  4. #4
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243
    Attached you wil find a small example of how you could do this.
    If you want some more info or a more specific solution to your application, just let me know.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •