Results 1 to 4 of 4
  1. #1
    mjhopler is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    26

    Login VBA


    I have form named frmLogin. In the form is a text box named LoginName where I will enter a username and a button named Login that runs a macro to hide the form in the background. I also have a table called Table1 with the field usernames. I would like to build VBA to be included in the On Click of the Login button that before it runs the macro, it will compare the text entered in the LoginName and compare it to the usernames in Table1. If the name does appear in the table, it runs the macro, if it does not appear in Table1, then it returns an error message "Username not found". What would the VBA for the Login button be?

  2. #2
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140

    Using Conditional Macro

    You can add a condition statement to your current Macro to do this for you.
    To better assist you...can you post a Screenshot of your Macro Screen?
    Thanks.

    -RC
    Last edited by MAF4Fam6; 02-10-2010 at 10:04 PM. Reason: Info requested was already provided.

  3. #3
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140

    Using a Conditional Macro to Check If Text Box's Value Exists in Table

    Insert the three Macro Actions per the following image into your current Macro:

    Attachment 648

    Here is the condition statement for you to copy/paste into your Macro:

    Code:
    DCount("*","Table1","[usernames]=Forms![frmLogin]![LoginName]")=0
    -RC

  4. #4
    finditsol is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    2
    i think this can help you to solve this problem

    Code:
    http://www.databasedev.co.uk/login.html

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

Similar Threads

  1. Login Screen in Access
    By Di7bash in forum Access
    Replies: 3
    Last Post: 03-18-2014, 11:57 PM
  2. How do I undo the requirement to login every mdb
    By garymkrieg in forum Security
    Replies: 3
    Last Post: 07-11-2011, 03:53 PM
  3. app.login
    By seen in forum Access
    Replies: 3
    Last Post: 07-18-2009, 01:19 AM
  4. Login Script
    By theITguy in forum Access
    Replies: 2
    Last Post: 03-06-2009, 03:37 AM
  5. Database Login Error
    By narasareddy in forum Access
    Replies: 0
    Last Post: 08-30-2008, 12:00 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