Update query same field multiple criteria

nad341

New member
Local time
Today, 00:12
Joined
Apr 21, 2013
Messages
4
Hi,
I need to update the periodtype field in my table depending on different values in the field Formtype- I am looking to do this without having to use VBA. I have the following fields in a table - I want to update the value of the field Period_type as follows -

When Formtype is 10-Q, update Periodtype to "Quarterly"
When Formtype is 10-K, update Periodtype to "Annual"

The current value of Periodtype for both formtypes is "Semiannual"

Can I do this using only update query?

Thanks
NAD
 
You can certainly do this using two update quieres.
Backup you data.
Then try:
When Formtype is 10-Q, update Periodtype to "Quarterly"
Use:
Code:
UPDATE [COLOR=red][B]YourTableName[/B][/COLOR] SET [B][COLOR=#ff0000]YourTableName[/COLOR][/B] .Periodtype = "Quarterly"
WHERE ((([B][COLOR=#ff0000]YourTableName[/COLOR][/B] .Formtype)="10-Q"));
When Formtype is 10-K, update Periodtype to "Annual"
Use:
Code:
UPDATE [B][COLOR=#ff0000]YourTableName[/COLOR][/B] SET [B][COLOR=#ff0000]YourTableName[/COLOR][/B] .Periodtype = "Annual"
WHERE ((([B][COLOR=#ff0000]YourTableName[/COLOR][/B] .Formtype)="10-K"));
You will need to change: YourTableName
 
Hi Bob,
Thanks for your reply. Very helpful.
 

Users who are viewing this thread

Back
Top Bottom