Results 1 to 6 of 6

Thread: Update records

  1. #1
    Join Date
    Sep 2004
    Location
    Greece
    Posts
    20

    Smile Unanswered: Update records

    Good morning every one (it is 7:24 here in athens)

    I wonder if someone can help me into this...

    I have the results of a query in a form. In every record i have a field yes/no. I want to update data in the records that I select yes. Is there a way with a button to update only the records that I select yes for them (records that comes out of the query)?

    Thanks in advance.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Yes there is ... Many ways.
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Sep 2004
    Location
    Greece
    Posts
    20
    such as? can you give something more?

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by damv
    such as? can you give something more?
    Well you can create a query to do it or you can run some SQL to do it ... Depends on what you want to change ...
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    damv - Mike is being difficult again, but you really don't give a lot of detail in your question so it's tough to make an intelligent response.

    here is a non-intelligent response: maybe it helps get you started

    private sub myButton_Click()
    dim strSQL as string
    strSQL = "UPDATE myTable SET thisField = " & myTextBox
    strSQL = strSQL & ", myCheckField = False WHERE myCheckField = True;"
    docmd.setwarnings false
    docmd.runsql strSQL
    docmd.setwarnings true

    note that .runsql is not the fastest thing that will happen on your machine. try some research into .execute

    izy
    currently using SS 2008R2

  6. #6
    Join Date
    Sep 2004
    Location
    Greece
    Posts
    20

    Wink

    Thank you both for your reply. Obvius i am new into access. I have solve the above problem but with (what i think) not a very good way.

    Lets see:

    The data from the main table with a query i store them into a temporary table. then the form reads the data from the temporary table. the data in the form are editable so i choose yes or no in the records i want. with a button i close the form (and so the data with the updated information are saved in the temporary table). Then i run another query which read the data from the temporary table checks who have the yes selected and updates the records in the main table.

    This actually works but i don´t think it is the right procedure.

    Any way thanks both of you for your reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •