Brian, Duane and John, thanks for helping me get this going.
Brian, I had actually tried your suggested construct originally but couldn't get it to work. What you provided works just fine, so I must have had a typo in my original attempt.
John, I appreciate the pointer on using Debug.Print to troubleshoot my strings to see what the SQL Parser is actually seeing. That will help me in the future.
Duane, you suggestion is what I have implemented because of it's simplicity, and I never would have thought to use NZ in that way. In fact, I modified you approach to simplify even a bit further based on information about my data that I didn't reveal in my original posting. Here's what I'm actually using:
SQL_text = "UPDATE Votes SET PartyVoted = 'O' " & _
"WHERE Nz(PartyVoted,'R') NOT IN ('R','D');"
So thanks again to all of you for moving me further down the road and helping me to learn!!
——
James
www.james-mc.com
Words To Live By
From: John Viescas johnv@msn.com
Reply: ms_access_professionals@yahoogroups.com ms_access_professionals@yahoogroups.com
Date: May 4, 2014 at 12:29:06 AM
To: ms_access_professionals@yahoogroups.com ms_access_professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Need help setting up query in VBA
Excellent answer, Duane!
Additional tip: When you find SQL in code not working as expected, add:Debug.Print SQL_text.. to your code. Run your code and then go to the Immediate Window (CTRL+G). You should see the SQL you tried to execute laid out as VBA interpreted it. If the error is not obvious (you were missing a space at the end of each line), you can copy and paste the text into a new query and then switch to Design view to get the SQL Parser to give you a better clue as to why it doesn't work.
John Viescas, AuthorMicrosoft Access 2010 Inside OutMicrosoft Access 2007 Inside OutMicrosoft Access 2003 Inside OutBuilding Microsoft Access ApplicationsSQL Queries for Mere Mortals(Paris, France)
__._,_.___
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Now you can search Photos & Files in your Group !
You can now search for photos and files in your Yahoo Group, in addition to searching for messages in your Group archive
.
__,_._,___
Tidak ada komentar:
Posting Komentar