Results 1 to 3 of 3
  1. #1
    dale_j1992 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2016
    Posts
    8

    Thumbs down Please help issue with VbA on a form

    Good morning i have been having a problem trying to get some code working, any help is much appreciated. Basically i have the initial form which the user scans an ID Card to log them in, this works perfectly, however i have added the option to press a command button to which opens a second form to input username and password if they have forgotten there card, this also works how i expected. The issue i am getting is i make the password form hidden so i can still use the inputted data to refer to the person who is logged in, for instance when completed checks and i have a text box called USER_NAME on the top of the page which displays the user currently logged in.


    i have the code working individually for each option using
    USER_NAME=Forms![RFIDlogin]!username.value


    USER_NAME=Forms![FRMLogin]!Cbouser.column(1)


    however because the user could use either option leaving it in this state does not work so i have tried using this code.


    If IsnotEmpty(Forms![RFIDlogin]!USERNAME.Value) Then
    USER_NAME = Forms![RFIDlogin]!USERNAME.Value
    Else
    Exit Sub
    If IsnotEmpty(Forms![Frmlogin]!cboUser.Value) Then
    USER_NAME = Forms![Frmlogin]!cboUser.Column(1)
    Else
    Exit Sub


    I am pulling my hair out and cannot get it to work, any information is greatly appreciated.


    kind regards

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Make USER_NAME a Tempvar, then it will be available project-wide any time you need it.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    for responders - crossposted here https://www.access-programmers.co.uk...d.php?t=292761

    @dale - please read this thread about crossposting http://www.excelguru.ca/content.php?184

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

Similar Threads

  1. Replies: 5
    Last Post: 11-18-2016, 10:27 AM
  2. Printing issue form a form (MS Access 2010)
    By gutenberg in forum Forms
    Replies: 7
    Last Post: 06-23-2016, 12:47 PM
  3. Replies: 5
    Last Post: 01-08-2015, 02:08 PM
  4. Replies: 3
    Last Post: 03-17-2014, 10:23 AM
  5. Replies: 22
    Last Post: 05-21-2013, 07:54 PM

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