Results 1 to 3 of 3
  1. #1
    jaymin is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jan 2012
    Location
    gold coast Australia
    Posts
    57

    Cool changing a combo box row sourcewith multi names to only one name in the row source

    I have a combo box with a row source written in a vba module under an IF statement, it populates the combo box with a list of staff names,
    HTML Code:
    Me.cboStaffSelection.RowSourceType = "Table/Query"       
    Me.cboStaffSelection.RowSource = "SELECT tblStaff.IDStaff, [Firstname] & "" "" & [Surname] AS FullName, * FROM tblStaff;"
    This is ok when staff with the correct security level view this list of staff in the combo box, what i want to do is when staff without the correct security level look in the combo box they see only there name, I have a variable the is the staff name that i can compare, but having trouble to populate the combo with this single name.
    It should be easy but have trouble getting.



    Thanks

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    Me.cboStaffSelection.RowSource = "SELECT tblStaff.IDStaff, [Firstname] & "" "" & [Surname] AS FullName, * FROM tblStaff WHERE theirname='" & theirname & "';"

    substiture 'theirname' with the relevant names you have used in the staff name variable and tblStaff table

  3. #3
    jaymin is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jan 2012
    Location
    gold coast Australia
    Posts
    57
    Ajax,
    Thanks for your help, sorry for the delay, had to work and could not get to a computer, I thought it might be something simple like that, not that experienced with select sql
    Regards
    Peter

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

Similar Threads

  1. Changing names to ID numbers
    By marksnwv1957 in forum Access
    Replies: 4
    Last Post: 08-28-2012, 03:47 PM
  2. Reports and changing the names
    By brobb56 in forum Access
    Replies: 9
    Last Post: 09-21-2011, 03:57 PM
  3. Changing table names from lowercase to uppercase
    By supernix in forum Database Design
    Replies: 1
    Last Post: 09-03-2010, 10:08 PM
  4. Changing names and labels
    By Geewaagh in forum Reports
    Replies: 29
    Last Post: 04-20-2010, 10:26 PM
  5. Changing field names in queries
    By scottsoo9 in forum Queries
    Replies: 1
    Last Post: 12-01-2009, 05:47 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