Checkbox interaction with Queries

hoikhype

Registered User.
Local time
Today, 16:53
Joined
May 22, 2013
Messages
15
1. In a form that I have created, I have a checkbox that I want to have checked when the form (help ticket) that was filled out has been completed by our company. I want the checkbox to only be accessed by us. How do I acheive this to only certain users have access to check that box?

2. I have a main screen that the form is able to be accessed by. In that home screen I have a query that shows what tickets have not been completed (checked). How do I get those tickets that have been checked, to not show up on that screen?
 
Do you have a logon form to determine who is logging into your database? If so, you could add code in the On Open event to test for specific users and hide/show the check box as desired.

To filter a form, in the record source for the form you can add a Criteria, in your case, CheckBox criteria would be set to False to only show the records that have not been checked off.
 
What do I need to put in the Criteria for it not to show up? I tried "False" and "No", and neither worked.

I don't have a logon form for the database.
 
I got the check box to work. Thanks!


I still don't know how to get that check box unlocked for certain users though.
 
For a checkbox (boolean data type) the values are false or 0 if not checked and true or -1 if checked.

Since you do not have a logon form, how do you intend to tell who is using the database? Do you want to use the Windows logon, if so here some basic code for getting the UserName:

Code:
Option Compare Database
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long



Function UserName() As String
    Dim lngLength As Long, lngX As Long
    Dim strUserName As String
    strUserName = String$(254, 0)
    lngLength = 255
    lngX = apiGetUserName(strUserName, lngLength)
    If lngX <> 0 Then
        UserName = Left$(strUserName, lngLength - 1)
    Else
        UserName = "unknown"
    End If
End Function

Place it in a module and you then can refer to the user by using the UserName as a variable in your VBA code.
 

Users who are viewing this thread

Back
Top Bottom