Update Query from Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nomeepk
    New Member
    • Jan 2014
    • 12

    Update Query from Form

    Hi,

    I want to make a form for Update Query to update order dates.

    As you know Query update requires:

    Criteria = Old Date
    Update to: New Date

    but i want it to get both old and new dates from a form.

    I think, you can get what i want to achieve.

    thanks in advance for your replies.
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Here's how I "cheat" on that.

    Make a copy of the data in question. (NEVER EVER work with the production file NOR the only copy of the data!!!!)

    Now, using the standard Query editor, build you select query to return the records you want to update. Run this and make sure that the records you want for a single instance are returned.
    Convert to the update query.
    enter your update values, etc...
    save
    run
    double check that this updated the desired records.
    Switch to SQL view
    And now you have the basic SQL script.

    You can use parameters at this point or you can use the form and pull that information from the form and build a SQL to use with the execute method.

    I'm going to send you to MS for a tutorial for how to:
    Use parameters in queries and reports

    You should be able to modify the saved query.

    Once you have this working in the copy of your database... simply import it into the production database!

    Comment

    • nomeepk
      New Member
      • Jan 2014
      • 12

      #3
      @Zmbd thanks a lot for giving me the idea.
      You are always the best.

      i have attached two pictures.

      here what i have done. what you do you think about that?



      and

      then created a button and used this code, got this basic code from a page and used it here:

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        Sorry, third party sites are not usually available to me when at work, nor to a large number of the experts. If you'd like to upload them here then use the advanced button under the post window, manage attachements, and upload the image to your bytes.com profile.

        Comment

        • nomeepk
          New Member
          • Jan 2014
          • 12

          #5
          Here both code and query?

          well it seems its working, not through form fields but...
          Attached Files

          Comment

          Working...