how can i create a button to save records and at the same time to do something else?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hannoudw
    New Member
    • Aug 2010
    • 115

    how can i create a button to save records and at the same time to do something else?

    I have a form contains 3 unbound text box and a button. i want when i fill all the 3 of boxes and i click on the button to set an update query on a table but at the same time i want to reopen the same form.
    i know how to do the query . but how can i reopen the same form after i click on the button "update another Price" for example?
    i can use the DoCmd.OpenForm "Name of the form" but how can i open the same one??
    any help?
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32645

    #2
    Why do you want to reopen the form when it's already open?

    Comment

    • hannoudw
      New Member
      • Aug 2010
      • 115

      #3
      well i want to change to do a form to save the discounted prices of the articles .
      so i did a form that contain 3 unbound text box.
      the 1st on i transfer it to a combo box contain all the articles # in the stock .
      the second one is the real price (before sale).
      and the third one is the price after discount.
      and i want to be able to do a loop so i could save the discounted prices , and reopen the same form to enter another discounted price for another article.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32645

        #4
        I'm sorry. Was that an answer to the question? I'm afraid it didn't explain it for me. Maybe I'm just tired.

        Comment

        • hannoudw
          New Member
          • Aug 2010
          • 115

          #5
          i just want to when i click on the button to save new records ... like when we have bound text box and we click on next record to save new records !!
          But the problem is that i'm working on unbound text box !!
          so when i fill these 3 text box and i click the button this will update the sale price in the table items (i'm just working on 1 table). so after that i need to update another item .... so that's why i need to reopen the same form !! get it ?? :)

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32645

            #6
            I think I have a better understanding now. It was what I was expecting to be frank - assuming I do indeed understand you correctly.

            Let me start by giving you the bad news. You can't open the form again using the code which is in the form. The form cannot be properly closed when some of its code is still active.

            The much better news is that it really isn't necessary. All you seem to want is to reset the form to its virgin state. That is accomplished quite easily by setting all the controls back to their default values. Not complicated.

            What I most want to do though, is to warn you of the inherent lack of sense involved in proceeding in the direction you seem to want to go in. There are situations where designing unbound forms to manage data in Access is a good idea. They are extremely rare though. I see nothing here to convince me this is anything other than you creating a great deal of work and complexity trying to do it all around Access, rather than using Access what it's already been designed quite well to do. It's a bit like buying a model kit and breaking it down into bits of wood and building your model from these bits. Not impossible, but not a great idea either.

            I don't know all the details of your project, and I'm certainly not in charge of it, but my advice would be to use Access to do what Access does unless you have good reasons to think otherwise. If you do, I have provided some instructions to help you.

            Good luck.

            Comment

            • hannoudw
              New Member
              • Aug 2010
              • 115

              #7
              well i have this table:
              item (article,descri ption,stock,pri ce,discounted_P rice,...)
              and i already did a form to fill it except from the discounted_pric e( that can be null).
              then how can i make a form to just update the discounted_Pric e ?? at first it's null , and some items don't have discount .... so how can i do this without unbound text box if i may ask?

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32645

                #8
                I don't see a problem with using the standard form wizard if you need to. Maybe I don't understand what you're trying to say, but I think it's straightforward enough. I just don't understand why you would think there was anything complicated about it.

                Comment

                • hannoudw
                  New Member
                  • Aug 2010
                  • 115

                  #9
                  ok thx NeoPa ...
                  i just made a form that contain one combo box that contains all the article # . and when i choose one # i made a simple wizard form and i locked all the text boxs except of the price after discount text box! and it worked ! thanks for your replies ... yes you're right i always think of complicated things . while i can do it easily from access, maybe cause i'm new in access . thx again :)

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32645

                    #10
                    I'm very pleased to hear that. It means I did understand you reasonably well all along :)

                    Your eventual solution description is exactly what I had in mind, so good solution. Well done.

                    Comment

                    • hannoudw
                      New Member
                      • Aug 2010
                      • 115

                      #11
                      Thx a lot
                      now i'm i'm trying to do something and it's not working i wrote it as a new question can you see it ?

                      ** Edit **
                      Details of other question removed
                      Last edited by NeoPa; Aug 5 '10, 11:04 PM. Reason: Details of other question removed

                      Comment

                      • NeoPa
                        Recognized Expert Moderator MVP
                        • Oct 2006
                        • 32645

                        #12
                        If you have posted your question in a new thread then you can post a link to it in here if you like. Otherwise, please do not post more than one question in a thread. It's against our rules.

                        Comment

                        Working...