Trevor, Assuming that after you check the CurrentUser and you do indeed
"see" a value in you unbound control, and now I assume a user uses a
combo/list box to select a query name, now I assume you click a button that
runs/opens the selected query. There's no reason you cant use something
like(air code)
Private Sub cmdRunQuery_Click()
Dim strQuery as String
strQuery = Me.cboQueryList
Select Case Me.AccessLvlControl
Case 1 'Full access
DoCmd.OpenQuery strQuery, , acEdit
Case 2 'Some access so check what query they selected
If strQuery = "qry1" or strQuery = "qry2" Then
MsgBox "Please select a different Query.", vbOKOnly +
vbInformation, "Access Denied"
Else
DoCmd.OpenQuery strQuery, , acEdit
End If
End Select
This is bare-bones so modify /test as necessary. Hope it helps. If not
post back with actual code/events etc. you are using!
--
Reggie
----------
"Trevor Hughes" <tr**********@inet.net.nz> wrote in message
news:10***************@kyle.snap.net.nz...
Reggie wrote: What code and when are you running it!
This the sequence of events:
1. Onopen event of form: Code gets CurrentWindowsUser and sets the value
on the unbound control of the form. Then a DLookup sets the value of
another unbound control to show that users "Access level"
2. I then run a query from a list of available queries. Before the
query runs, my code checks to see if the CurrentWindowsUser has the
correct "Access level" to run the query. It's at this point where the
contents of the unbound control "Access level" is not correctly accessed.
Trevor