Results 1 to 5 of 5

Thread: Form Name change: Runtime

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    Not a VB question, but I'm here anyway.

    In Access, how do you change the Form Caption at runtime? For example:

    Code:
    Private Sub tabControl_Click()
        
        Select Case (Me.tabControl.Tag)
        
            Case 1: 'CUDOS
                    ActiveForm.Caption = "CUDOS"
            Case 2: 'CAPSIS
                    ActiveForm.Caption = "CAPSIS"
            Case 3: 'MSP
                    ActiveForm.Caption = "MSP"
            Case 4: 'Service Package
                    ActiveForm.Caption = "Service Package"
            Case Else:
                    ActiveForm.Caption = "Unknown"
        End Select
        ActiveForm.Refresh
        
    End Sub

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Just like you said, except remove all instances of the word ActiveForm and the period that comes afterwards.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    nope, does not work. I am trying to set the Form.Caption to a something that depends on which Tab I am in on the Tab Control, hence the Case Statement. I tried your suggestion but nothing happened.

  4. #4
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    You can have a Click event for each tab on the control.

    Go to the Tab Control's properties while the first Tab is selected, and change the Name property to "CUDOS".
    For the second Tab change the Name to "CAPSIS".
    And so on.
    Then use this code:
    Code:
    Option Compare Database
    Option Explicit
    
    Private Sub CAPSIS_Click()
        Caption = "CAPSIS"
    End Sub
    
    Private Sub CUDOS_Click()
        Caption = "CUDOS"
    End Sub
    
    Private Sub MSP_Click()
        Caption = "MSP"
    End Sub
    
    Private Sub Service_Package_Click()
        Caption = "Service Package"
    End Sub
    Maybe we are talking about completely different things, though?
    I wouldn't know, I barely ever use Access.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    Thanks Yonatan, I had also thought of that, but it does not work either. Its not that important I just wanted to do it, then when I could'nt I got all upset. Guess I'll just forget it.

    Thaks for trying anyway.

Posting Permissions

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



Click Here to Expand Forum to Full Width