Solved

Open Form - Filter Field - Update Another Field in Table

Posted on 2016-09-30
2
23 Views
Last Modified: 2016-09-30
Hi,

OnClick I'd like to open a form, filter by a field, and with ONLY the filtered records I'd like to update a Yes/No field in a table.

I've done the easiest bit, but also I'd like to update a field called 'SelectedPrint' in my 'Contacts' table with 'Yes' for every record filtered 'KI1100'

DoCmd.OpenForm "InvoiceEmail"
DoCmd.ApplyFilter , "Account = 'KI1100'"

Open in new window


Can anyone help?

Thanks,
0
Comment
Question by:Jack Marley
2 Comments
 

Accepted Solution

by:
Jack Marley earned 0 total points
ID: 41823601
Solved it myself, don't know if this is the best method but it works!

DoCmd.SetWarnings False
SQLtext = "update Contracts set SelectedPrint= Yes where Account='KI1100'"
DoCmd.RunSQL SQLtext
DoCmd.SetWarnings True

Open in new window

0
 
LVL 35

Expert Comment

by:PatHartman
ID: 41823615
Most times you don't want a hard-coded value so here is a better example:

SQLtext = "update Contracts set SelectedPrint= 'Yes' where Account= '" & Me.txtAccount & "'"

Or, if SelectedPrint is a Yes/No data type then:

SQLtext = "update Contracts set SelectedPrint= True where Account= '" & Me.txtAccount & "'"
1

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question