Question about Reports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • plasmastar
    New Member
    • Mar 2010
    • 9

    Question about Reports

    I'm doing an Access inventory program. I already got practically everything done, but there's only one thing that's giving me trouble right now, and it involves the reports. I'm going to try to explain it as general as possible.

    Suppose you have item#1, and item#1 has attribute#1, attribute#2, attribute#3 and attribute#4. Now, suppose you have item#2, and item#2 has attribute#2 and attribute#4.

    Now, in the table, an item that doesn't have a certain "attribute" will receive a N/A. For example, since item#2 only has attribute#2 and 4, in item#2's column value for attributes #1 and #3 will be N/A.

    Now, on to my problem. Using a query of that table, I will be creating a report as a sort of "receipt". The receipt will show the items and their respective attributes. However, what I want is that when it writes an item, the attributes that it doesn't have doesn't write it. For example, if I want to write item#2, I don't want the attributes #1 and #3, since they will display N/A, and I don't think it looks good.

    I already have the necessary code for it, my problem is that I don't know when it will execute. I've tried it on report load, but it only takes the value of the last field. I need the code to check every time it writes an item. Does anyone how how to do this? Please this is the only thing I have to do to finish my program.
  • hedges98
    New Member
    • Oct 2009
    • 109

    #2
    I might have read this wrong but couldn't you change the query slightly. So in the criteria for each attribute you could put <> "N/A" (so the query will display all fields where it doesn't display "N/A"). That's assuming that every attribute field in your table(s) are attributed with an "N/A" value if the item doesn't have that attribute.

    Hope that makes sense!

    Comment

    • TheSmileyCoder
      Recognized Expert Moderator Top Contributor
      • Dec 2009
      • 2322

      #3
      To give a proper answer, you will have to provide your code, as well as your table structure. Are all attributes stored in the main table or in subtables?

      Comment

      • plasmastar
        New Member
        • Mar 2010
        • 9

        #4
        Ok, my inventory program is for trading cards called Yu-Gi-Oh. These cards are divided in three types: Monster, Spell and Trap. Monsters have monster type, attack and defense. Spells and Traps don't have these, so whenever it is a spell or trap, I have a N/A value in those three fields. In the report, I want to hide those three fields whenever the card type is spell or trap. I hope that makes things easier.

        Hedges: I tried what you said but the problem is that it hides the whole card, not just the column.

        Comment

        • hedges98
          New Member
          • Oct 2009
          • 109

          #5
          Are all of those fields stored in one single table?

          Comment

          • plasmastar
            New Member
            • Mar 2010
            • 9

            #6
            Yes, and my key fields are Card Name and the condition of the card.

            Comment

            • TheSmileyCoder
              Recognized Expert Moderator Top Contributor
              • Dec 2009
              • 2322

              #7
              You should put monster type, attack and defense into a seperate table, and then draw the info into your report using a supReport.

              Comment

              • plasmastar
                New Member
                • Mar 2010
                • 9

                #8
                It still deletes the whole item. The only thing I need right now is a way to check a field of the report everytime it receives new information every time it writes a new item. That's the only thing I need so I can check and delete and put my code to work. If I have 4 cards to display, I need to check the field "CardType" 4 times to check if it's the type I want, that's all. Now, can anyone tell me how to do this? I tried report load and it only checks the last one, and cardtype_afteru pdate doesn't work either.

                Comment

                • TheSmileyCoder
                  Recognized Expert Moderator Top Contributor
                  • Dec 2009
                  • 2322

                  #9
                  You should put it in the Detail_Format.

                  Comment

                  • plasmastar
                    New Member
                    • Mar 2010
                    • 9

                    #10
                    sigh. It didn't work, maybe what I'm trying to do is impossible. I've searched everywhere and tried everything.

                    Comment

                    • TheSmileyCoder
                      Recognized Expert Moderator Top Contributor
                      • Dec 2009
                      • 2322

                      #11
                      Ive asked you before to provide the code your using. I can't really help you otherwise.
                      This would be an example of how it could work.
                      Code:
                      Private Sub Detail_Format(Cancel as integer)
                      If me.tb_CardType=1 then
                        me.tb_Attack.Visible=True
                      else
                        Me.tb_Attack.Visible=False
                      end if

                      Comment

                      • plasmastar
                        New Member
                        • Mar 2010
                        • 9

                        #12
                        Code:
                        If Me.CardType = "Spell" Or Me.CardType = "Trap" Then
                            Me.MonsterType.Visible = False
                            Me.MonsterType_Label.Visible = False
                            Me.Attack_Label.Visible = False
                            Me.Attack.Visible = False
                            Me.Defense.Visible = False
                            Me.Defense_Label.Visible = False
                            Me.Price.Left = 4.3333 * 1440
                            Me.Price_Label.Left = 4.3333 * 1440
                        Else
                            Me.MonsterType.Visible = True
                            Me.MonsterType_Label.Visible = True
                            Me.Attack_Label.Visible = True
                            Me.Attack.Visible = True
                            Me.Defense.Visible = True
                            Me.Defense_Label.Visible = True
                            Me.Price.Left = 6.0833 * 1440
                            Me.Price_Label.Left = 6.0833 * 1440
                        End If
                        Sorry for not posting it before. This is how it goes, whenever it is spell or trap it will hide monster type, attack and defense and move the price to the left so that it looks better. I need this code to be executed everytime a card is added to the report. I tried detail format and it didn't work, like always it takes the information of the last one.
                        Last edited by NeoPa; Mar 10 '10, 01:04 PM. Reason: Please use the [CODE] tags provided.

                        Comment

                        • TheSmileyCoder
                          Recognized Expert Moderator Top Contributor
                          • Dec 2009
                          • 2322

                          #13
                          Do you have 1 card per "detail" section or are you cramming em all into the same detail section?

                          These things should work (in the Detail_Format) unless your doing something odd in your report. If you cannot get it to work, attach your DB to this thread (compact before doing so) and I will take a look at it for you.

                          Comment

                          • plasmastar
                            New Member
                            • Mar 2010
                            • 9

                            #14
                            Ok I attached the program here, I think (sorry still new to the website). If you could help me out here I would appreciate it a lot. Also there's a mixture of english and spanish there, so if you have any questions let me know.
                            Attached Files

                            Comment

                            • TheSmileyCoder
                              Recognized Expert Moderator Top Contributor
                              • Dec 2009
                              • 2322

                              #15
                              What version of Access are you using?

                              Nvm. Saw the file format.

                              Comment

                              Working...