Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The Problem! I have a logon f

Status
Not open for further replies.

Syerston

Programmer
Jun 2, 2001
142
GB
The Problem!

I have a logon form which allocates each user a district (eg. 01,07 etc). This value is passed to a variable which determines what records the user is able to see. However, several users should be able to see all the records in the database.

Is it possible to pass a value to the variable from the field on the user table which can be used as a "wildcard".

Or is there another way.

Yours hopefully
John
 
I am guessing you have a table behind this logon that has already assigned the districts to each user.
I would add a yes/no field (bALL) as a flag that the user should see all districts.
[tab]If bALL = True then
[tab][tab](show all records)
[tab]Else
[tab][tab](show District records -- the method you use now)

Alternately, using a district code of 99 (or whatever you choose) you can set up an if statement similar to the one above: IF District = 99 then ...

I hope this helps.
 
I see where you're coming from. However, as the district ID is assinged to a string value in a Module's Public Function to allow it to be passed from form to form, how do I assign this "see all records" value to the variable if the first 'If' statement is true.

P.S There are 26 districts.
John
 
I would use a SQL string (or named query)to set the RecordSource property of the forms.

Dim strSQL as string
If strDistrict = 99 Then
[tab]strSQL = "SELECT * FROM table"
Else
[tab]strSQL = "SELECT * FROM table " & _
"WHERE table.district = strDistrict"
END IF
form.RecordSource = strSQL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top