Require data entry in both form AND subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VBANovice
    New Member
    • May 2007
    • 5

    Require data entry in both form AND subform

    HI!!!

    I am in the process of building an Accounting Database. I have two tables. The first table is the Journal Entry Header and the second table contains the Journal Entry Details (the accounts to debit and credit as well as the debit and credits themselves). Its a basic one to many relationship.

    I have both tables on a form. The Journal Entry Header is on top and the Journal Entry Details is the subform. Is there a way I can force the user to fill out both the form and the subform before submitting the record?

    Another problem is the tab key. If the controls of the form are filled out, the tab key allows the user to submit the data WITHOUT a entry in the subform and that is not good...

    Any advice and suggestions would be appreciated!!! Thanks in advance!
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    How are they "submitting " the data, by inherent processes? Or are they manually doing it through a button press. By your tab description, it sounds as if it's a little of both.

    Comment

    • VBANovice
      New Member
      • May 2007
      • 5

      #3
      If there is a way to suppress the "Tab Key" and prevent the User from "Tabbing" thru the controls, that would be useful....

      In the end, however, I want the user to fill out the controls on the form as well as the controls on the subform. Two different tables that are linked together.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You can turn off the tab functionality by setting the tab stop property of the controls to no. But most users expect this functionality.

        However, my question was how are they "submitting " the data. What happens when they submit the data? What do you want to happen instead?

        Comment

        • VBANovice
          New Member
          • May 2007
          • 5

          #5
          I would like to ensure that the JE Headers (the "one" of the one-to-many relationship) cannot be added to the table unless it has at least one JE_details (the "many" of the one-to-many relationship). The JE_details table is filled by using a subform and it is located on the form for JE Headers.

          The accountants would ideally have to press a submit button that would validate the entries (both JE_Headers form and the JE_Details subform on it...)

          Hope this is clear....

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Well, there's no need to turn off the tab key if it's not tabbing them to a new record. All you really need to do is to run a DCount to see if there's at least one record in the subform before running the rest of the command button code.

            Comment

            • tezza98
              New Member
              • Mar 2007
              • 38

              #7
              when the user clicks the save button check to see if the inputs in the subform arent null

              if they arent null then save the records, if they are null , pop up a message box, and set focus to the null input


              Code:
              public sub on_click()
              
              If Me!Subform1.Form!ControlName.Value Is NULL then
              Msgbox "this subform value must not be null
              Me!Subform1.Form!ControlName.setFocus
              Else
              ' repeat for next input
              else
              DoCmd.SaveRecord
              End IF
              yes i know my code is not correct and full of mistakes but the fundamentals are there

              this is a good site that i use to remind me how to get access to the subform values from the parent form and visa-versa

              http://www.mvps.org/access/forms/frm0031.htm

              Comment

              Working...