Results 1 to 4 of 4
  1. #1
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283

    Calling Field Values from another form to a text box on a separate form

    I have a login for that is a drop down where the users select their name and a password box.


    The drop down on the Logon_Form is driven by the row source of
    Code:
    SELECT TblEmployees.XeroxCanada_EmpNo, [VSE_FirstName] & ' ' & [VSE_Surname_Name] AS Fullname, TblEmployees.strEmpPassword, TblEmployees.PWReset, TblEmployees.accesslevel_id, TblEmployees.Mgr_EmpNo, TblEmployees.OpsMgr_EmpNo FROM TblEmployees ORDER BY TblEmployees.VSE_FirstName, TblEmployees.VSE_Surname_Name;
    On the main form I am using the default value to auto populate ids on the creation of a new record.
    The User's id (XeroxCanada_EmpNo) is captured by
    Code:
    =[Forms]![Logon_Form]![cboUser].[Column](0)
    and this works as expected
    The Users manager's id (iMgr_EmpNo) s captured by
    Code:
    =[Forms]![Logon_Form]![cboUser].[Column](5)
    and this works as expected
    The Manager's Manager id (OpsMgr_EmpNo) is captured by
    Code:
    =[Forms]![Logon_Form]![cboUser].[Column](6)
    and this does not return the value.

    When I run the initial query used by the Logon_Form with the User's name I am testing with all the ids return as expected.

    Is there a limit to the number of columns or something I am missing as to why I can put any number 5 or less and return the expected value but once I enter 6 it returns blank?

    Thanks as always for the assistance

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    You cannot use .columns in a query.
    you CAN put another textbox on the form, fill it with the column value after user picks it.
    then use THAT textbox in the query.

    Code:
    sub cboBox_afterupdate()
      TxtBoxCity = cboBox.column(2)
    end sub

  3. #3
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    I am not sure I understand. Why would what I have work fine for Columns 0-5 but not for column 6?

  4. #4
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    I figured it out. The default value for column count is 5. Once I changed it to 6 the 6th column is now coming through

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

Similar Threads

  1. Replies: 4
    Last Post: 04-23-2016, 02:14 AM
  2. Replies: 3
    Last Post: 04-03-2015, 04:36 PM
  3. Replies: 1
    Last Post: 09-16-2014, 12:32 PM
  4. Replies: 10
    Last Post: 05-22-2013, 02:56 PM
  5. Replies: 1
    Last Post: 05-09-2012, 02:22 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