468,773 Members | 2,517 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,773 developers. It's quick & easy.

Unbound control problem

I am trying to resolve a problem I'm experiencing in Access 2000.

I have an unbound control which is set be code on the open event of a
form. However when I try to subsequently run some code which references
the value in the unbound control, the code cannot see the value set. If
however I manually type in the value into the unbound control the code
works fine.

I have tried to Refresh and Repaint the form, but this does not solve
the problem.

If anyone can suggest a solution, I would be very greatfull.

TIA
Trevor
;)
Nov 13 '05 #1
3 2193
What code and when are you running it!

--
Reggie

----------
"Trevor Hughes" <tr**********@inet.net.nz> wrote in message
news:10***************@kyle.snap.net.nz...
I am trying to resolve a problem I'm experiencing in Access 2000.

I have an unbound control which is set be code on the open event of a
form. However when I try to subsequently run some code which references
the value in the unbound control, the code cannot see the value set. If
however I manually type in the value into the unbound control the code
works fine.

I have tried to Refresh and Repaint the form, but this does not solve
the problem.

If anyone can suggest a solution, I would be very greatfull.

TIA
Trevor
;)

Nov 13 '05 #2
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
Nov 13 '05 #3
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

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Cameron Laird | last post: by
3 posts views Thread by Dos Lil | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.