A couple of questions here.
1. I have two queries that I'd like to combine into one if possible:
Query 1
UPDATE Registrations SET Registrations.PVGPrimaryGOP = Nz(IIf([registrations]![Primary2004PartyVoted]="R",1,0))+Nz(IIf([registrations]![Primary2006PartyVoted]="R",1,0))+Nz(IIf([registrations]![PresPrimary2008PartyVoted]="R",1,0))+Nz(IIf([registrations]![Primary2010PartyVoted]="R",1,0))+Nz(IIf([registrations]![Primary2012PartyVoted]="R",1,0)), Registrations.PVGPrimaryDem = Nz(IIf([registrations]![Primary2004PartyVoted]="D",1,0))+Nz(IIf([registrations]![Primary2006PartyVoted]="D",1,0))+Nz(IIf([registrations]![PresPrimary2008PartyVoted]="D",1,0))+Nz(IIf([registrations]![Primary2010PartyVoted]="D",1,0))+Nz(IIf([registrations]![Primary2012PartyVoted]="D",1,0)), Registrations.PVGPrimary = Nz([registrations]![Primary2004])+Nz([registrations]![Primary2006])+Nz([registrations]![Primary2008])+Nz([registrations]![Primary2010])+Nz([registrations]![Primary2012]), Registrations.PVGGeneral = Nz([registrations]![General2004])+Nz([registrations]![General2006])+Nz([registrations]![General2008])+Nz([registrations]![General2010])+Nz([registrations]![General2012]);
Query 2
UPDATE Registrations SET Registrations.PVGGeneral = 6, Registrations.PVGPrimary = 6, Registrations.PVGPrimaryDem = 6, Registrations.PVGPrimaryGOP = 6
WHERE (((Registrations.PVGGeneral)=0) AND ((Registrations.PVGPrimary)=0) AND ((Registrations.PVGPrimaryDem)=0) AND ((Registrations.PVGPrimaryGOP)=0) AND ((Registrations.date_of_registration)>#11/6/2012#));
How can I combine them to populate the four PVG fields with numbers (0 through 6) in a single operation? Right now I run Query 1(to put in 0 -6) first and then Query 2 (to put in 6), which I occasionally forget to do.
2. In query 2 I have a fixed date (#11/6/2012#) which I'd like to put in the ElectionDate field in a separate table (Settings). If I do this, how do I refer to it in the query?
I'm using Access 2010 here.
Thanks for the help!
——
James
www.james-mc.com
Words To Live By
Sent from Airmail app on Mac
__._,_.___
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (1) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar