Events.....When Do they happen

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32668

    #16
    That all depends on what the current situation is. I'd appreciate a little more feedback from you if we're to work together. What have you managed to do and what state is the project in since my last posts?
    I don't like to work directly on other people's databases as a general rule. We may get to that stage but let's avoid it until it's absolutely necessary.

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #17
      As to learning when events are triggered (and this method can also be used to verify whether an event is being triggered or not) a simple way is to place a messagebox in the event sub.

      This code will pop up a message box if the control's BeforeUpdate event is triggered:
      [CODE=vb]Private Sub YourTextBox_Bef oreUpdate(Cance l As Integer)
      MsgBox "BeforeUpda te for " & Me.ActiveContro l.Name & " Has Occurred!"
      End Sub
      [/CODE]
      This will do the same thing for the AfterUpdate event.
      [CODE=vb]Private Sub YourTextBox_Aft erUpdate()
      MsgBox "AfterUpdat e for " & Me.ActiveContro l.Name & " Has Occurred!"
      End Sub[/Code]

      Note that the line of code in each sub (Line # 2 ) is generic, which is to say it can be used in the BeforeUpdate/AfterUpdate of any control and will pop a messge with that control's name.

      Linq ;0)>

      Comment

      • ethanhines
        New Member
        • Oct 2007
        • 29

        #18
        Originally posted by NeoPa
        Ethan,

        The picture was some help. It doesn't seem to indicate which controls are what though. I'm trying to follow your code but without understanding what [ITEM]; [SIZE] & [SUB TOTAL]
        [ITEM],[SIZE], AND [SUBTOTAL] are all fields in a table (Preferably the subform, but I don't know how to reference a field in a subform, Plus I still have that pesky problem of haveing to click on the subform before it updates with the data from the main form. Sorry Guys I only wish you were here so I could explain better....can I upload the database to someone to take a look?

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32668

          #19
          Actually they are not fields as used here. Me![name] implies controls (on a form or report). Fields are found within records in tables.
          Now, you haven't yet updated us with what you tried and what worked (to what extent). I get that you're not used to this level of discipline when communicating, but we need the info to be of any use to you.

          In as much as I can help I will :
          Try (Referring to Items on a Sub-Form) for the subform references.
          Remember the difference between forms and recordsets. A form updates and simply shows you the information. A recordset updates and the data is now changed behind the scenes.
          I suspect that a .Requery of something is required somewhere here but we're still too much in the dark for me to understand where as yet.

          Comment

          • ethanhines
            New Member
            • Oct 2007
            • 29

            #20
            AfterUpadte event is not available on the toggle button, only on the frame since I used the option control to assign numerical values values to the text values...does this make sense? Here....there database it's not large... http://www.badongo.com/file/4794919 .

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32668

              #21
              Ethan,

              It is not a good idea simply to post databases.
              The idea is to explain your problem clearly and concisely so that someone can understand it just by reading your text. Unfortunately your explanations have been consistently unclear as to what you are trying to communicate.
              I get the impression that you're trying, but so many attempts to get simple information out of you seems to be falling on deaf ears. It doesn't even seem as if you're reading anything that's posted on here to help you. I keep getting the same questions put forward that have already been answered and never any response to what I say - so that we can move forward. You keep trying to start again but without any better ways of explaining your problems.

              I downloaded your database, but it was stored in a format that my A2003 system doesn't even recognise :(
              This was to check out the link rather than to work on it. I think you need to show more effort in this before I'm going to go to the trouble of working on your database for you.

              Comment

              • MMcCarthy
                Recognized Expert MVP
                • Aug 2006
                • 14387

                #22
                Ethan

                The options within an option frame don't have the same events available as the frame itself. There is no before update and after update event available on the toggled options. Simply Got Focus, Lost Focus, mouse move and key press events. It is unusual to code events on the toggle options. Usually events are coded on the frame.

                If you are just interested in checking coding event choose a textbox control to test.

                If there is some particular reason you want to trigger something on the toggle option then please explain in detail and we will see if we can help.

                Mary

                Comment

                • ethanhines
                  New Member
                  • Oct 2007
                  • 29

                  #23
                  Originally posted by mmccarthy
                  Ethan

                  The options within an option frame don't have the same events available as the frame itself. There is no before update and after update event available on the toggled options. Simply Got Focus, Lost Focus, mouse move and key press events. It is unusual to code events on the toggle options. Usually events are coded on the frame.

                  If you are just interested in checking coding event choose a textbox control to test.

                  If there is some particular reason you want to trigger something on the toggle option then please explain in detail and we will see if we can help.

                  Mary
                  That's just it Mary, there is no Afterupdate on a Toggle Button, but if I use the Code given to me, in the afterupdate of the frame, then the toggle button doesn't stay down.
                  To put it simply all I want to do is have a frame with toggle buttons that input data into a subform in datasheet format in real time. I donèt want to have to click on the sub form for it to update.

                  Comment

                  • MMcCarthy
                    Recognized Expert MVP
                    • Aug 2006
                    • 14387

                    #24
                    Originally posted by ethanhines
                    That's just it Mary, there is no Afterupdate on a Toggle Button, but if I use the Code given to me, in the afterupdate of the frame, then the toggle button doesn't stay down.
                    To put it simply all I want to do is have a frame with toggle buttons that input data into a subform in datasheet format in real time. I donèt want to have to click on the sub form for it to update.
                    Can you post the code you are currently using on the frame after update event. I would guess that with some minor additions we can get it to work.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32668

                      #25
                      Ethan,

                      Please read posts 12 through 14 again. This is all fully explained there (and took a fair while to sort out). If you still don't understand what the problem is post back and let me know.

                      Comment

                      • ethanhines
                        New Member
                        • Oct 2007
                        • 29

                        #26
                        Originally posted by mmccarthy
                        Can you post the code you are currently using on the frame after update event. I would guess that with some minor additions we can get it to work.
                        Marry,
                        Now that I am explicitly referring to the controls on the sub form (that is to say the textbox) a strange thing is happening.....t he Buttons stay down but they only update the subform îf I press the other button. Here is the Code so far:
                        [CODE=vb]
                        Private Sub Frame_SUB_SIZE_ AfterUpdate()
                        Select Case Me![Order subform].Form![SIZE]
                        Case 1
                        Me![Order subform].Form![SIZE] = "6 inch"
                        Me![Order subform].Form![SUB TOTAL] = 5
                        Case 2
                        Me![Order subform].Form![SIZE] = "12 inch"
                        Me![Order subform].Form![SUB TOTAL] = 7.5
                        Case Else
                        'fall through
                        End Select
                        End Sub
                        [/CODE]
                        Originally posted by NeoPa
                        mentioned something about I suspect that a .Requery of something is required somewhere here but we're still too much in the dark for me to understand where as yet
                        I have no idea where to put this.

                        Comment

                        • MMcCarthy
                          Recognized Expert MVP
                          • Aug 2006
                          • 14387

                          #27
                          OK am I mistaken or is your Frame called "Frame_SUB_SIZE " in which case your code should be as follows:

                          [CODE=vb]
                          Private Sub Frame_SUB_SIZE_ AfterUpdate()

                          Select Case Me!Frame_SUB_SI ZE
                          Case 1
                          Me![Order subform].Form![Size] = "6 inch"
                          Me![Order subform].Form![SUB TOTAL] = 5
                          Me![Order subform].Requery
                          Case 2
                          Me![Order subform].Form![Size] = "12 inch"
                          Me![Order subform].Form![SUB TOTAL] = 7.5
                          Me![Order subform].Requery
                          Case Else
                          'fall through
                          End Select

                          End Sub
                          [/CODE]

                          Comment

                          • ethanhines
                            New Member
                            • Oct 2007
                            • 29

                            #28
                            Originally posted by mmccarthy
                            OK am I mistaken or is your Frame called "Frame_SUB_SIZE " in which case your code should be as follows:

                            [CODE=vb]
                            Private Sub Frame_SUB_SIZE_ AfterUpdate()

                            Select Case Me!Frame_SUB_SI ZE
                            Case 1
                            Me![Order subform].Form![Size] = "6 inch"
                            Me![Order subform].Form![SUB TOTAL] = 5
                            Me![Order subform].Requery
                            Case 2
                            Me![Order subform].Form![Size] = "12 inch"
                            Me![Order subform].Form![SUB TOTAL] = 7.5
                            Me![Order subform].Requery
                            Case Else
                            'fall through
                            End Select

                            End Sub
                            [/CODE]
                            That Did it! However I should point out that I had to change:
                            [CODE=vb]Select Case Me!Frame_SUB_SI ZE
                            to
                            Select Case Me![SIZE][/CODE]
                            Don't ask me why...I wish I knew..Thanks Again!

                            Comment

                            • NeoPa
                              Recognized Expert Moderator MVP
                              • Oct 2006
                              • 32668

                              #29
                              I'm a little confused here Ethan.
                              Did you set the value of a frame to a string and still find that the Option Button worked properly?
                              Could you post your eventual code here for curiosity (and to display the final resolution).

                              I'm pleased it's working for you anyway :)

                              Comment

                              • ethanhines
                                New Member
                                • Oct 2007
                                • 29

                                #30
                                Originally posted by NeoPa
                                I'm a little confused here Ethan.
                                Did you set the value of a frame to a string and still find that the Option Button worked properly?
                                Could you post your eventual code here for curiosity (and to display the final resolution).

                                I'm pleased it's working for you anyway :)
                                Sure here it is BTW SUB_SIZE doesn't mean Subroutine it stands for Submarine Sandwich :)
                                [CODE=VB]
                                Private Sub Frame_SUB_SIZE_ AfterUpdate()
                                Select Case Me![SIZE]

                                Case 1
                                Me![Order subform].Form![SIZE] = "6 inch"
                                Me![Order subform].Form![SUB TOTAL] = 5
                                Me![Order subform].Requery

                                Case 2
                                Me![Order subform].Form![SIZE] = "12 inch"
                                Me![Order subform].Form![SUB TOTAL] = 7.5
                                Me![Order subform].Requery

                                Case Else
                                'fall through

                                End Select
                                End Sub
                                [/CODE]
                                ------------------------------------
                                Now if I may bother you again I have two last lssuses and I promise I won't bother you again....
                                -------------------------------------------
                                The First is.. notice [SUB TOTAL], what I am doing is adding the value of the sub be it 6 inch or 12 inch to a field on a table, but what happens is if I press the 6inch button then the 12 inch button it keeps adding up... what I need is a way to make sure the bill of sale is right.
                                ------------------------------------------------------
                                Secondly,
                                I'm making all my Buttons Large Enough So When We get a touch screen it won't be hard to use. But I need the Checkboxes to be big as well, nico5038 mentioned using continuous forms with an image to be "bounded" to a tablefield. and an additional field needs to be defined, else all images will react,and The Onclick Event of the image needs to be used to switch from True.jpg to False.jpg or vise versa.But I have no clue how to do that?....Can you give me step by step instrustions on how to do that.Thanks

                                Comment

                                Working...