Storing Values in database using Forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • drago
    New Member
    • Jul 2007
    • 14

    #1

    Storing Values in database using Forms

    Hello guys again! Back with invoice problems. Just want to know how to store data in the main database in different tables and fields using a form. I have a datasheet view of a form where i have to show ;

    Code:
    invoice number                      (INPUT) 
    price                                     (INPUT)
    No. of units                            (INPUT),
    Weekly Total          (calculated by =[no_of_units]*[price]) 
    start date                               (INPUT)
    end date                                (INPUT) 
    days                      (=[end_date]-[start_date]+1)
    total amount           =(([Weekly_total]*[days])/7)
    Now, All this is working but not storing the values. If that works i will be jumping for a whole week :P Please help me jump. What should i do to store these values in specific fields..:)
    Takecare
    thanks in advance

    mj
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    You have inadvertently posted your question in the Articles section rather than in the Forum section of our site, so I have moved it across for you.

    Linq ;0)>

    Comment

    • mlcampeau
      Recognized Expert Contributor
      • Jul 2007
      • 296

      #3
      Originally posted by drago
      Hello guys again! Back with invoice problems. Just want to know how to store data in the main database in different tables and fields using a form. I have a datasheet view of a form where i have to show ;

      Code:
      invoice number                      (INPUT) 
      price                                     (INPUT)
      No. of units                            (INPUT),
      Weekly Total          (calculated by =[no_of_units]*[price]) 
      start date                               (INPUT)
      end date                                (INPUT) 
      days                      (=[end_date]-[start_date]+1)
      total amount           =(([Weekly_total]*[days])/7)
      Now, All this is working but not storing the values. If that works i will be jumping for a whole week :P Please help me jump. What should i do to store these values in specific fields..:)
      Takecare
      thanks in advance

      mj
      What are/is your table structure(s) that house the above fields? Are you currently using a query for your form?

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Drago,
        Remember the data is all stored in tables not on forms. Forms are like windows that allow you to see some of the data. They only hold data transiently (while they're open) and even that is logically just a view of the underlying data (tables or queries).

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          All this is working but not storing the values.
          Exactly how is it working then if it's not storing your data?

          Comment

          • drago
            New Member
            • Jul 2007
            • 14

            #6
            Originally posted by missinglinq
            Exactly how is it working then if it's not storing your data?
            Hi again, thanks for moving this question to forum section :). Sorry about that as iam still learning the forum life style which is very helpful.

            I have created an invoice table with attributes invoiceID(invoi ce number), item_price (price), no_of_units(Num ber of units), Weekly_Total, start_date, end_date, Days, Monthly_Total(t otal amount)
            Originally posted by drago
            Code: ( text )
            invoice number (INPUT)
            price (INPUT)
            No. of units (INPUT),
            Weekly Total (=[no_of_units]*[price])
            start date (INPUT)
            end date (INPUT)
            days (=[end_date]-[start_date]+1)
            total amount =(([Weekly_total]*[days])/7)
            I have to input data in the database table manually, except the fields where calculation is required (which is also not saving the values after calculation. Is it possible to do so?). On the form these values are displaying. I want to input these values in the database table using form or anything else. Iam not using any queries at the moment for this.

            With regards

            mj

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32669

              #7
              Drago, storing calculated values is really NOT a good idea. If you're interested why, check out Normalisation and Table structures.
              I'm confused as to how you think it might be appropriate to store total values (presumably across many invoices) in a table designed to handle invoices (individuals).
              Your last post seems to say that you are editing the data directly in the table, but then goes on to refer to a form you are using. I'm confused as to what is actually hapening. The form would make more sense certainly.

              Comment

              • drago
                New Member
                • Jul 2007
                • 14

                #8
                Originally posted by NeoPa
                Drago, storing calculated values is really NOT a good idea. If you're interested why, check out Normalisation and Table structures.
                I'm confused as to how you think it might be appropriate to store total values (presumably across many invoices) in a table designed to handle invoices (individuals).
                Your last post seems to say that you are editing the data directly in the table, but then goes on to refer to a form you are using. I'm confused as to what is actually hapening. The form would make more sense certainly.
                Thanks for your reply. Amm... so form are used just to view records. Thats fine. Suppose if I want to store values (not edit) in database using an interface. What should i do then. For example what i mean is if u enter name, dob, address in 3 different text fields it goes in to the database and create a new record.
                I hope this will help u.

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32669

                  #9
                  Forms can certainly be used as an "interface" for adding, editing and also deleting records in a table. The data is still "stored" in the table but it is displayed on the form.
                  The database, is an object which contains all the code, forms queries AND tables (etc etc).

                  Comment

                  • drago
                    New Member
                    • Jul 2007
                    • 14

                    #10
                    Originally posted by NeoPa
                    Forms can certainly be used as an "interface" for adding, editing and also deleting records in a table. The data is still "stored" in the table but it is displayed on the form.
                    The database, is an object which contains all the code, forms queries AND tables (etc etc).
                    great...so now for example if iam calculating values on the form taking some values from database like

                    attribute A= 90 - want to save in the database
                    attribute B=30 - want to save in the database
                    attribute Total= A-B = 60 - this calculated value i want to save in the table

                    please dont be mad at me as iam trying my best... iam new to this...

                    Comment

                    • mlcampeau
                      Recognized Expert Contributor
                      • Jul 2007
                      • 296

                      #11
                      Originally posted by drago
                      great...so now for example if iam calculating values on the form taking some values from database like

                      attribute A= 90 - want to save in the database
                      attribute B=30 - want to save in the database
                      attribute Total= A-B = 60 - this calculated value i want to save in the table

                      please dont be mad at me as iam trying my best... iam new to this...
                      As NeoPa said, you should not be storing attribute Total in the table. It is fine if you have a textbox on your form that calculates the total, or if you design a query that calculates it, but you shouldn't actually store the value. In the quote above, you seem to not have actually asked a question regarding what you want to save in the table. What are you trying to ask?

                      Comment

                      Working...