Kamis, 18 Mei 2017

Re: [MS_AccessPros] Filter

 

Kevin-


If you look at strWhere (perhaps by doing a Debug.Print), it looks like:

'John Smith='55

That is not a valid predicate, so you'll either get an error or no rows.

Also, the arguments for OpenForm are:

FormNameViewFilterNameWhereConditionDataModeWindowModeOpenArgs

The fifth argument probably should be one of the data modes, like acFormEdit, not acFotm.  Are you trying to specify the View?  I prefer to use named arguments to avoid having to count commas, like this:

DoCmd.OpenForm "frmGroupList, WhereCondition:=strWhere, View:=acNormal, WindowMode:=acDialog

Notice that you don't have to specify the arguments in order, and by using the parameter names, it's easier to see what it going on.

What is in IDName and EmployeeID?  What is the name of the field you're trying to filter, and what does it contain?

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On May 18, 2017, at 12:08 PM, qing qing qingqinga@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Dear All,

I would like to get the result of:

"SomeID=" & Me.EmployeeID as a filter

I have a text field IDName stores the name of the "SomeID" as title not as value.

So I wrote something like:

strWhere=""" & IDName & "="" & Me.EmployeeID

Then I apply it as this:

DoCmd.OpenForm "frmGroupList", , strWhere, , acFotm, acDialog

I didn't get the result I expected. Please help, Thanks.

Best Regards,

Kevin



Kevin Zhao




__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (15)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar