I THINK the issue is here:
DoCmd.OpenReport "rContactSimilar", acViewPreview, , "[SoundsLike] = " & strSoundEx
I THINK strSoundEx needs to be surrounded by single quotes, but I'm not sure if the WhereCondition argument is read like a query or not.
(I put a space around the single quotes on the first line so you can see it easier, but it should be in code like the 2nd line)
"[SoundsLike] = ' " & strSoundEx & " ' "
"[SoundsLike] = '" & strSoundEx & "'"
Hope that works
-Lee
--- In MS_Access_Professionals@yahoogroups.com, mrsgoudge <no_reply@...> wrote:
>
> After updating the LastName field on the Contacts form I would like to open a report with similar last names. I am getting an "Enter Parameter Value" msgbox and S530 (the SoundExBrowne value of the name that I am trying to do a where condition on) is the message. If I enter S530 into the msgbox txtbox the report is correct. If I don't enter any parameter of course the report is blank.
>
> The code trying to pull up the report is:
> On Error GoTo Proc_Err
> strSoundEx = SoundexBrowne(LastName)
> DoCmd.OpenReport "rContactSimilar", acViewPreview, , "[SoundsLike] = " & strSoundEx
>
> The query that is working correctly for the report is:
> SELECT Contacts.LastName, Contacts.FirstName, Contacts.SpouseFN, Contacts.SpouseLN, SoundexBrowne([LastName]) AS SoundsLike
> FROM Contacts
> ORDER BY Contacts.LastName, Contacts.FirstName;
>
> Thanks! I know this probably very simple. Have been working and working and working ... to get this to work and my head won't get around it.
>
> Connie
>
Selasa, 27 September 2011
[MS_AccessPros] Re: Opening filtered or code with where condition in code
__._,_.___
MARKETPLACE
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar