Unbound control problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Trevor Hughes

    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
    ;)
  • Reggie

    #2
    Re: Unbound control problem

    What code and when are you running it!

    --
    Reggie

    ----------
    "Trevor Hughes" <trevorhughes@i net.net.nz> wrote in message
    news:1091140715 .492962@kyle.sn ap.net.nz...[color=blue]
    > 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
    > ;)[/color]


    Comment

    • Trevor Hughes

      #3
      Re: Unbound control problem

      Reggie wrote:[color=blue]
      > What code and when are you running it!
      >[/color]
      This the sequence of events:
      1. Onopen event of form: Code gets CurrentWindowsU ser 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 CurrentWindowsU ser 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

      Comment

      • Reggie

        #4
        Re: Unbound control problem

        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_Cli ck()
        Dim strQuery as String
        strQuery = Me.cboQueryList
        Select Case Me.AccessLvlCon trol
        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" <trevorhughes@i net.net.nz> wrote in message
        news:1091155791 .832692@kyle.sn ap.net.nz...[color=blue]
        > Reggie wrote:[color=green]
        > > What code and when are you running it!
        > >[/color]
        > This the sequence of events:
        > 1. Onopen event of form: Code gets CurrentWindowsU ser 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 CurrentWindowsU ser 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[/color]


        Comment

        Working...