473,394 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

On Current control.visible not working

I have a command button on a form that should be visible or not visible depending on a value in the current record and the current users user level. The code below is working as in the immediate window i get true and false when appropriate. However the command button will stay in its current state for several records. At times when I switch to the immediate window and back the button will do what it is supposed to do (ie be visible or hide). I tried the repaint method to force it but did not suceed.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     If (CurrentUser.GetUserLevel <= 10 And Me.txtQStatusType = 9) Or (CurrentUser.GetUserLevel <= 10 And Me.txtQStatusType = 13) Then 'Admin
  3.         Debug.Print "true"
  4.         Me.cmdAward.Visible = True
  5.         Me.Repaint
  6.     Else
  7.         Debug.Print "false"
  8.         Me.cmdAward.Visible = False
  9.         Me.Repaint
  10.     End If
  11. End Sub
Mar 24 '08 #1
3 3246
missinglinq
3,532 Expert 2GB
What version of Access are you runnnig? I can find, thru v2003, no reference to CurrentUser.GetUserLevel in VBA Help, reference books or on line. CurrentUser by itself, in VBA, returns a string that gives the name of the account that opened the db. You didn't, perchance, get this code from a Visual Basic source rather than a VBA source, did you?

I also wonder if txtQStatusType is actually defined as a number? If it's defined in your table as Text datatype, you'd need quotation marks around the 9 and the 13.

The only other thought would be corruption of some sort.

Linq ;0)>
Mar 25 '08 #2
I'm running 2007.
currentuser is a instance of a class i made, if you change due dates and such it records who you are and when you did it. I did not check that 'currentuser' was used elsewhere.
QStatusType is defined as a number (long)
Mar 25 '08 #3
Could it have anything to do with when the information in the text box gets the current records information vs when the form's current event fires?
Mar 25 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: JingleBEV | last post by:
Hi all, I have a masked text control that would return a date in string format via the mask property like: "9/23/2004" and i have a calendar control that would pop up when I click a command...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
3
by: bbdata | last post by:
what would be an equivalent of OnCurrent event/Forms , in detail section of the Report? i have a subreport with just one (visible)field, bounded to a query. subreport is in detail section of main...
1
by: Susan Bricker | last post by:
Greetings. I am trying to position opened forms so that they are cascaded on the screen. I have discovered the movesize action (for the DoCmd) and Move property of a form (for Acc 2002/2003). ...
5
by: Simon Harris | last post by:
Hi All, I am trying to call a method in a web form, from an event fired in a user control. My user control displays a map, which has a link button to enlarge/shrink the map. When the user...
6
by: Selden McCabe | last post by:
I have a form with a bunch of image buttons. When the user moves the mouse over a button, I want to do two things: 1. change the Imagebutton's picture, and 2. make another control visible. I'm...
4
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
31
by: jcrouse | last post by:
Is there a quick and easy way to change the color of a label controls border from the default black to white? Thank you, John
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.