Results 1 to 2 of 2
  1. #1
    collen is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    3

    VB Code in Access 2007

    Please assist me..I have developed a simple application in access 2007. I have a login screen which authenticates the user against details in a user table and if this is successfull it opens the switchboard and closes the login screen.On the switchboad i have 3 buttons.
    The above setup works fine, what i am now struggling with is to implement a security feature, I have updated my user table to have a boolean field named group, what i am hoping to achieve is to distinguish different users based on this boolean value e.g. if the value is 0 the user will be able to see all the 3 buttons on the switchboard and if the value is 1 the reports button must be disabled.


    This is a code i have so far and it doesnt work...im not use if the best place to put the code is on the on-click event of the submit button on login screen or on the form load of the switchboard

    Code:
     Dim stDocName As String
      Dim stLinkCriteria As String
      Dim varX As Variant 
       
      varX = DLookup("[group]", "Table1", "[username] = '" & [Combo2] & "'") stDocName = "Switchboard"
      DoCmd.OpenForm stDocName, , , stLinkCriteria If varX = 1 Then
           Forms![Switchboard]!Option3.Enabled = False End If
      ---------
      Table1 = name of user table
      Combo2 = name of combo box on login form that lists users names 
    
      Option3 = name of reports button on switchboard

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Maybe this link will help: http://allenbrowne.com/ser-15.html

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access 2007 Code Guru please: Unbound Attachment
    By MatthewFF in forum Programming
    Replies: 2
    Last Post: 02-01-2010, 07:31 AM
  2. Replies: 6
    Last Post: 12-01-2009, 11:59 AM
  3. Access 2003 code vs Access 2007 Code
    By ralphjramirez in forum Access
    Replies: 5
    Last Post: 11-23-2009, 12:33 PM
  4. Replies: 0
    Last Post: 11-17-2009, 02:35 PM
  5. Access 2000 and 2007 VB code
    By gnuman in forum Access
    Replies: 0
    Last Post: 08-26-2009, 05:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums