Retrieve the values from a listbox in table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • guruchans15
    New Member
    • Feb 2010
    • 4

    Retrieve the values from a listbox in table

    Hi,

    I have a table "Table1" which contains 2 fields named as "f1" f2".

    Table1
    f1 f2
    xyz 1
    xyz 2
    abc 3

    and have another table named as "Table2" which contains the fields "f3", "f4"

    f3 contains values from the f1 of table1 which is listbox(ie sql query, select f1 from table1 is mentioned in the recordsource of f3).

    Now I got stuck into the f4. I want to retrieve the value from f2 of table1 by using sql query in the table( record source of f4 in table2). I dont want to use any macro or forms. I want the values to be retrieved through the tables itself. I need sql query for it.

    Can any1 guide me through this . It wil be of gr8 help!!

    Thnx
    Guru
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Guess you'll have to study first the rules of normalization before making a copy of a table using queries.

    Your action will create two similar tables just with different fieldnames.

    Nic;o)

    Comment

    • guruchans15
      New Member
      • Feb 2010
      • 4

      #3
      Hi Nic,

      I do understand the normalization, but i have got up prob in some other stuf. Sorry i wouldnt have explained the prob quite well.

      i will make it simple so tat u or any1 in this forum could provide me a soln

      i have a table which contains 2 flds named n1 and n2
      n1 is a listbox which retrieves the values from another table. now i want soln for n2 field. when a user selects the value from listbox of n1 fld the corressponding value shld be displayed in n2 field as the cursor is moved. I want to write the query in n2 record source for it. I do not want macro or module for it. i want it to be done in a single table.

      can u or any1 provide me soln for it

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        You don't need to store the n2 field as it's defined by the value of n1.
        For making it visible multiple options are available as filling an unbound field on a form or by JOIN-ing the tables and posting the n1 and value for n2 from the related table.

        Nic;o)

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32634

          #5
          We have a rule (Check rules) that prohibits the use of text-speak type abbreviations because they do not help communication.

          In this case you clearly have problems expressing yourself clearly to start with and the abbreviations just make it even harder to understand you.

          Please try to express your question clearly in simple English, then we can see what we can do for you.

          Comment

          • guruchans15
            New Member
            • Feb 2010
            • 4

            #6
            Hi Neo/Nic

            Table1
            id name
            1 Guru
            2 JJ


            Table2
            cid name(listbox ie Guru/JJ) value
            3 Guru 10
            4 Guru 20
            5 JJ 05

            Table2.name field is liked to Table1.name field

            Table3
            tid name(listbox-Guru/JJ) value(listbox)
            1 Guru 10 ( out of 10 or 20)
            2 JJ 30


            I want table3 , where name field should retrive based on table 1 which should be a listbox and based on value selected only those values should be allowed to choose in value field

            Ex: if user selects Guru in table3.name field, then value 10 or 20 should be alowed to choose in value field

            if user selects JJ in table3.name field then value 30 should be alone showed in table3.value

            I want the sql to be written in name table3.value record source. So please help
            me out.

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32634

              #7
              The first thing to do, before anything else, is to ensure that the tables are correctly linked. Let me illustrate the layout you should be looking at for what you've described :
              Table=[Table1]
              Code:
              [U]Field     Type        Index[/U]
              ID        AutoNumber  PK
              Name      String
              Table=[Table2]
              Code:
              [U]Field     Type        Index[/U]
              CID       AutoNumber  PK
              ID        Number      FK
              Value     Number
              Table=[Table3]
              Code:
              [U]Field     Type        Index[/U]
              TID       AutoNumber  PK
              ID        Number      FK
              Value     Number
              The name value is never stored in tables 2 or 3. Just the ID links to [Table1].[Name], although this may show in your table layouts as the name if you have set it up that way. The important thing to remember is that only the [ID] is actually stored.

              Comment

              • guruchans15
                New Member
                • Feb 2010
                • 4

                #8
                hi neo

                can i get the cell position in the access table.

                suppose if the user is the table3.id field in the 2nd row. is it possible in the query or in the module to get position where the cursor is pointing. As I knew we can retrive only in Excel sheet.

                If yes, plz provide me the solution that will solve my prob..

                thnx
                guru

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32634

                  #9
                  Either you don't understand me or you're deliberately ignoring me. In either case I see no point in continuing to offer help. Good luck with your problem, and try to avoid breaking the rules (see earlier post).

                  Comment

                  Working...