Question from basic database creator.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JCH
    New Member
    • Jan 2007
    • 3

    Question from basic database creator.

    Basically is this, I have 3 tables:

    Table Students:
    ID (autonumeric)
    Name (Text)
    Subjet (Numeric)

    Table Subjets:
    ID (autonumeric)
    Description (Text)

    Table Assigned:
    ID (autonumeric)
    Name (Numeric)
    Subjet (Numeric)

    I use a form to feed the Assigned table using the students and subjet tables, on that form I have a Combo Box that shows me all the students, and below I have a List Box to pick wich Subjet will be assigned.

    The question is:
    Can I make it to assign multiple subjets at the same time?, because every time I go to the next record the student name is lost and I must find the student again, and it is hard to find the same student because there are MANY with similar names.....
  • lwwhite
    New Member
    • Dec 2006
    • 16

    #2
    You want to set up a Students form containing a Table Assigned subform, built off the tables of the same names. Your Students form would be a single form and your Table Assigned subform would probably be a datasheet. After selecting the student on the main form, you'd select each subject the student is taking as a separate record in the subform. This keeps the current student in focus and you can associate as many subjects as you need with that student before moving on to another student record.

    I would also suggest not using a combo box for the students. It sounds like you have a lot of students and a long combo box is going to be awkward for users and potentially slow to load. You might instead want to add Find functionality to the form (using the control wizard to add a Find button might be sufficient for your needs here).

    Hope this helps,
    lw

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32662

      #3
      It seems to me there are two fundamental possibilities here :
      1. Bound Form
        Have two bound ComboBoxes (form bound to [Assigned]).
        If the most recent selection is lost when going to the NewRecord position in the recordset then remember the last selection (in the AfterUpdate event of the controls) then reset them to the last value saved in the OnCurrent event of the form.
      2. Unbound Form
        As you have the form but create a command button (cmdCreate) which takes the values from the ComboBox and the ListBox and, cycling through them creates the new records in [Assigned] using a SQL SELECT INTO (Append) query. The last bit could also be done in DAO.Recordset VBA code if that method is preferred.

      Comment

      • JCH
        New Member
        • Jan 2007
        • 3

        #4
        Originally posted by NeoPa
        Bound Form
        Have two bound ComboBoxes (form bound to [Assigned]).
        If the most recent selection is lost when going to the NewRecord position in the recordset then remember the last selection (in the AfterUpdate event of the controls) then reset them to the last value saved in the OnCurrent event of the form.
        I thing this one is my option... But I'm really a newbie doing this, I know cero code.

        Yeah the most recent selection is lost every time I go tho the NewRecord, and I tried to remember the last selection in the AfterUpdate but I think I can't do that with a macro. Do I have to type a code?

        Thanks.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32662

          #5
          Originally posted by JCH
          I think this one is my option... But I'm really a newbie doing this, I know zero code.

          Yeah the most recent selection is lost every time I go to the NewRecord, and I tried to remember the last selection in the AfterUpdate but I think I can't do that with a macro. Do I have to type in code?

          Thanks.
          Yes, you will have to use some code.
          I will try to knock something up for you later. I'm about to leave the office for a number of hours so will have to remember this later.

          Comment

          • JCH
            New Member
            • Jan 2007
            • 3

            #6
            Originally posted by NeoPa
            Yes, you will have to use some code.
            I will try to knock something up for you later. I'm about to leave the office for a number of hours so will have to remember this later.
            Thanks, I appreciate your help.

            If you know some site regarding Aaccess programming I'd appreciate it too. Because, I don't want you to do my work I just want to learn how to do it.

            Comment

            • missinglinq
              Recognized Expert Specialist
              • Nov 2006
              • 3533

              #7
              Link

              In regard to learning Access, if you go to the beginning of this forum you'll see a posting titled Tutorials on Access and VBA where Mary has kindly posted a number of links to tutorials on various aspects of Access programming. Also at the link below is a very good site with a free tutorial dividing up Access developement into 22 or 23 lessons.

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32662

                #8
                Originally posted by JCH
                Thanks, I appreciate your help.

                If you know some site regarding Aaccess programming I'd appreciate it too. Because, I don't want you to do my work I just want to learn how to do it.
                An excellent attitude.
                I think MissingLinq's answer is perfect for you :)

                Comment

                Working...