Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Set caption (Access 2000)

    I want to use one and the same button to set a caption and do different actions, according to my attachement. I want to captions to be invoice, and take some actions and order and take oher actions.How can i do that ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Set caption (Access 2000)

    What do you want to set the caption of? The button itself, or the form, or a label?

  3. #3
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set caption (Access 2000)

    Thank you for the so quick reply.I want the event to be on the OnClick event of the button.beside the caption, i want also with the this clicking to change the record source of the form.For the invoice it will be query1 and for the orders it will be query2.Also, withthis click event i want to change the label in the form.It should also read invoice or order.Thank you

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Set caption (Access 2000)

    Something like this?

    Private Sub CmdCaption_Click()
    If Me.CmdCaption.Caption = "Invoice" Then
    Me.RecordSource = "query1"
    Me.CmdCaption.Caption = "Orders"
    Me.Label4.Caption = "Invoice"
    Else
    Me.RecordSource = "Query2"
    Me.CmdCaption.Caption = "Invoice"
    Me.Label4.Caption = "Orders"
    End If
    End Sub

  5. #5
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set caption (Access 2000)

    Thank you for your reply.I tried to accomodate your code in order to have the name invoice as default and then click the button if i want to choose order.The problem i have is with the switching off betwen ther two options, invoice and order.I have attached what i have done but my result is not as good .Which is the best wau to do that ?

    regards

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Set caption (Access 2000)

    As I suggested in my previous reply, you can use an If ... Then ... Else ... End If construction to make the command button switch between the two options. You originally mentioned that the queries were named Query1 and Query2, in your database they are named qryInvoice and qryOrders, so you should use those names instead of Query1 and Query2.

Posting Permissions

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