Solved

Open Form - Filter Field - Update Another Field in Table

Posted on 2016-09-30
2
31 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 37

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 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