Code to filter records if regular user; if Admin show all

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello -

How would I code a form so a regular user would only receive records they
entered for the day (way to allow if no records, show new blank record)? The
Admin, obviously will be able to see all records. The Record Source for
properties in the form for all records is qryCalls.

My code currently has fOSUserName as the user name pulled off the system.

Any help will be appreciated!
 
You'll have to store the creator username in the record.
You'll also need a table of user names saying who is regular and who is an
admin.

For regular users, in the openevent for the form change the source query
based on what type of user to include the clause "WHERE UserName = " &
CurrentUser
You could also do it through the ApplyFilter statement

-Dorian
 
Hello Dorian:

Thanks for your response. I did do it through the ApplyFilter and it works.
I was also trying to filter for the current date and found out I had lost my
default in the table for the time; thus, I got strange results.

Perhaps I could press you for another problem I have -- I have used two
dropdownlists and a textbox as part of the form. These comboboxes and
textbox reference a "lookup" table (not the ones the wizard creates) via a
number stored in the master table. What is happening is when the arrow is
clicked for the previous record, nothing shows in the comboboxes or textbox.
How do I get the actual previous records to display? Is there some sort of
previous record event I can use that would somehow referencie the key? If
so, how do I do that?
 
Forgot to add this into my reply:

Would you happen to know how secure just filtering records for the user is?
Is that the recommended way to do it?
 
Sandy said:
Hello -

How would I code a form so a regular user would only receive records they
entered for the day (way to allow if no records, show new blank record)? The
Admin, obviously will be able to see all records. The Record Source for
properties in the form for all records is qryCalls.

My code currently has fOSUserName as the user name pulled off the system.

Any help will be appreciated!
 
Back
Top