Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    London, Gtr London, United Kingdom
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    code behind a button (a97)

    I have a customer activity form with a button (show customer activity for the past 12 months), when I click on it 1 of 2 things happen:-

    1. If they have used us over the past 12 months my subform shows ok with the revenue for each month showing, even if they have only traded for 1 month in the last 12 it will show that and 0.00 in each of the other months.

    2. if they have not traded a pop up box says 'this account has not traded over the last 12 months" with an OK button, however when I click the OK button I would like nothing to happen, as it is it shows my 12 month view with the #name? error in each of the monthly boxes. What code would you suggest behind the ok button to tell it not to show the 12 month view?

    Any help appreciated

    Thanks


    Steve

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

    Re: code behind a button (a97)

    What does the Show customer activity button currently do (i.e. what is the On Click code now)?

  3. #3
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    London, Gtr London, United Kingdom
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: code behind a button (a97)

    Hi Hans,

    I have called the people that own the database who won't or unwilling to tell me that and they say that they cannot stop it acting in this way. I am, as you aware, not very proficient with Access but having been dipping in and out of the forum for years for my own projects thought it would be possible to add something to the onclick event like onclick don't show subform whatever.

    Is that over simplistic of me to think that?

    Cheers

    Steve

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

    Re: code behind a button (a97)

    I guess it would be possible, but without knowing the code that the button runs now, it is impossible to give specific advice.

    Can you open the form that contains the button in design view? If so, select the button, then activate the Event tab of the Properties window. The On Click event will probably contain [Event Procedure]. If so, clicking in this event, then clicking the three dots ... to the right will take you to the Visual Basic Editor. The insertion point will be inside a piece of code starting with

    Private Sub ..._Click()

    and ending with

    End Sub

    You can copy this code to the clipboard and paste it into a reply.

  5. #5
    3 Star Lounger
    Join Date
    Oct 2001
    Location
    Newport, Gwent, Wales
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: code behind a button (a97)

    This might solve the pronlem, without any need for more information about the code.

    Add the response variable to the declaration section, then alter the line with the message box to something similar to what is below.

    Dim response As String

    response = MsgBox("The current message",vbOk,"The current title")
    If response = vbOK Then
    TheSubFormName.Visible = False
    End If


    Hope this helps

    Ian

Posting Permissions

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