Selasa, 27 September 2011

[MS_AccessPros] Opening filtered or code with where condition in code

 

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

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar