Kamis, 18 Mei 2017

Re: [MS_AccessPros] Filter

 

John-
Yes, John Smith='55 is the result after debug.print.
How to get this? "John Smith =" & 55
Best Regards,
Kevin


Kevin Zhao




On Thu, May 18, 2017 at 7:19 PM +0800, "qing qing qingqinga@yahoo.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:

 

John-
This is a long story. Let me organize my word to make it short and easy to understand.

I have table named tblEmployMenu which stores the form names.

tblEmployeeMenu
EMID
EmployeeID
EMFormName
FilterID
FormType

tblFormType
FTID
FormType

e.g. Data in tblFormType

1    edit
2    read only
3    filter by ID

So in the tblEmployeeMenu, If FormType is 3, Employee(user) can open the form vie filter which matches the FilterID (e,g.CoachOperatorID) of the opening form, and the "EmployeeID" of the current user. The EmployeeID is behind the frmEmployeeMenu, and it opens all the time.

Sorry for my poor English. I hope you may read me well enough by now. Thanks a lot for your patience.

Kevin Zhao




On Thu, May 18, 2017 at 6:37 PM +0800, "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:

 

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: qing qing <qingqinga@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (17)

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