Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table field's value based on value of another field same table

Status
Not open for further replies.

aonefun

Technical User
May 21, 2007
79
US
I would like to set the value of an Access database table field to "Yes" if another field in the same record (of the same table) contains the value "invoice".

Can I insert If statements into the SQL table view?
If yes, what is the proper syntax to achieve this result?
If not, what is the solution. (When responding please bear in mind that I have a very limited programming knowledge)
 
I would like to exclude any customer that has an invoice in our system from a fax campaign. If the docstatus="invoice" then I would like faxremove to equal"yes
 
You do not need an additional field, you need a query. You can build the query using the query design window. In SQL view, it will look something like:

[tt]SELECT Forename, Surname, Address, Fax
FROM tblCustomers
WHERE docstatus<>"Invoice" OR docstatus Is Null[/tt]
 
In the SQL view pane:
UPDATE [your table name here]
SET faxremove='yes'
WHERE docstatus='invoice'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top