Show all records event

G

Guest

I have a form that is being run by a query. The query name is qryPersonnel it
filters the records on who can see what. Easy so far and I know the next part
is too but I can't remember how to do it. What I am trying to do is if a
person from "support" or "admin" logs in they can view all records and
override the query specific.

The code in the open event of the form is as follows:

Private Sub Form_Open(Cancel As Integer)

[Duty Section].SetFocus
dValue = [Duty Section].Value

Me.AllowEdits = False
AddMember.Visible = False
Support.Visible = False
[temp].Visible = False
Me.AllowDeletions = False
[Authorize Purchase].Visible = False

If dValue = "Support" Then
Forms![Personnel]!AddMember.Visible = True
Forms![Personnel]!Support.Visible = True
[Authorize Purchase].Visible = True
Me.AllowEdits = True
End If

If dValue = "Admin" Then
Forms![Personnel]!EPR.Visible = True
Me.AllowDeletions = True
End If


End Sub
 
C

Crystal

Hi Darrin,

Instead of using criteria in the query, set the form filter
when you load the data

me.filter = "SomeID=3 and SomethingElse = 'WhatToLookAt'"
me.filteron = true

Then, you can remove the filter when desired:

me.filteron = false
me.requery

also, I see you are using the OPEN event to reference
control values... you need to use the LOAD event as the data
is not yet loaded on open

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top