Solved

Open Form - Filter Field - Update Another Field in Table

Posted on 2016-09-30
2
17 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 34

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
TT Column Arrange 10 28
subform does update on ms/access 2 16
How to compare data in excel 5 28
Merge Statement 3 0
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now