Filter query using variables

Withnail

New member
Local time
Today, 16:57
Joined
Apr 5, 2001
Messages
7
Hello again

Once a user logs on to my database, they initalise a variable called Current_User. This will be their full name.

In another part of the database, certain pieces of work are allocated to the various users by their manager. This is done by selecting a name from a drop-down menu. The format of the name is identical to the name that would populate the current_user variable.

The Question: Does anyone have any ideas how I can code a command button, so when the click it, a form opens up that only displays the records that have been allocated to them by filtering the records according to the current_user variable?

Many thanks

Withnail
 
Setup the recordsource of form using the open event
ie
Dim strSQL as string
strSQL = "Select * from YourTable where USERFIELD = '" & current_user & "'"
Me.recordsource = strSQL

Hope this helps
John
 

Users who are viewing this thread

Back
Top Bottom