473,385 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help using form filters

Hi,

I am trying to use vb code to set the filter on a form so that only
people with a common property can see each other on a form when they
open it (like if they are in the same department). But I cannot seam to
get the filters to work correctly and most of the time I'm just getting
no records to display.

Could someone lead me onto the right path?

Mar 1 '06 #1
2 1482
Possibly someone could make a useful suggestion if they knew just a little
more detail of what you have, and what you are trying to accomplish. Could
you clarify?

From whence do you determine the "affinity" or "value" for the "filter"?
"Filtering" can be accomplished in multiple ways, one of which is to create
a "WHERE clause without the WHERE" for use as the WhereCondtion argument of
a DoCmd.OpenForm statement. In many cases, however, I prefer to create the
entire SQL statement, and pass it to a newly-opened form in the OpenArgs
argument, then set it as the Form's RecordSource in the Open Event of the
Form.

Larry Linson
Microsoft Access MVP


"Jeff" <je**************@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi,

I am trying to use vb code to set the filter on a form so that only
people with a common property can see each other on a form when they
open it (like if they are in the same department). But I cannot seam to
get the filters to work correctly and most of the time I'm just getting
no records to display.

Could someone lead me onto the right path?

Mar 1 '06 #2
Ok, This is what I have. I have information for about 200 people in a
database, from several different departments. Its all pretty basic
stuff, like contact info and pay rate and such. So when someone logs
into the database they need to see a limited number of records based on
their position (or database rights). For instance, a department manager
needs to be able to see their employees, but not the employees of a
different department. And I want people to be able to login and update
their own information without them being able to see other people's
records.

I was trying to accomplish this using the form property filter, but I
can't seem to get it to work. To be more specific, on Form_Load() I had
code that looked up the current user's permissions, and department.
Then I set the filter as follows if they were the dept manager:

Me.Filter = "WHERE tblEmployee.deptID='" & userDept & "'"
Me.FilterOn

And like if they did not have database rights:

Me.Filter = "WHERE tblEmployee.userName='" & currentUser & "'"
Me.FilterOn

So, is there a better way to do what I am trying to accomplish, or am I
just missing some small detail that is keeping this from working?

Thanks for you help in advance.

Mar 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Keith Morris | last post by:
Hi all! I'm creating a mini CMS that will store content in a MySQL database. What I am trying to do is parse the content and replace certain keywords with a link. The keywords and associated...
5
by: MGFoster | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've converted an ACC97 .mdb file to an ACC2K2 .adp. A report that worked in ACC97 doesn't work in ACC2K2. Report setup: ACC97 ...
1
by: Jeff Smeker | last post by:
I have, over the past few years, developed a Access system that is in use in our companies engineering, purchasing, and sales departments. It is a fairly complex system that runs great. So, I am...
3
by: Neil Hindry | last post by:
I wonder if you can help me. I have setup an address-book database in Access XP. I have the first name & surname as separate fields. As I wanted to sort my database by surname and then by first...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
3
by: ATS | last post by:
I'm trying to set up a slide show on a web page using Javascript. Here is the code I have so far: <script language="javascript"> alert("**in test area 1"); slides = new Array(); slides =...
5
by: favor08 | last post by:
have a mainform called PendingsMain and a subform called PendingsSub. You can filter the subform by different filters and this works fine. i want to create a report that will print out the...
2
by: shawnwperkins | last post by:
Hi Folks, I'm new to Javascript and just need a little help. I downloaded a script from Dynamic Drive's Web site and I'm trying to make a simple modification and could use some help. :) The...
2
by: Moiseszaragoza | last post by:
I am not sure if this goes in here ot the ASP forum I have been trying to get some simple AJAX on my site but its not going so well I am not sure what my problems is what i am trying to do is...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.