Results 1 to 6 of 6
  1. #1
    hlogoma is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2011
    Posts
    7

    Question Runtime Error on assigning a ComboBox value to a control on a Form

    Hi,



    I have this control, ctljoinEmployeeId, on my form and it is empty at the time that I want to assign a value to it.

    In the add a record mode, I fill-in a combo box, cboEmployee, by choosing an employee name. In the After Update event for this combo box I assign the EmployeeName to a control, ctlEmployeeName, and all is well. Also at this point I want to assign the EmployeeId to a control, ctljoinEmployeeID. In the AfterUpdate for the for the Employee combo box the code to assign the EmployeeID is: Me.ctljoinEmployeeID = Me.cboEmployee.column(0). Both of the data types are text and the ctljoinEmployeeId is bound to a table field whilst the cboEmployee is bound to yet another table field, more correctly two fields, the name and id.

    Any idea why I am getting a runtime error on this assignment or any suggestions as to how I can assign the cboEmployee.column(0) attribute to ctljoinEmployee control?

    Thanks,

    Tom.
    Last edited by hlogoma; 06-10-2011 at 02:06 PM. Reason: puntuation

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Why are you storing the name and the ID in the table? You should ONLY be storing the ID in the table. The Employees table already has the name so you would be violating the rules of normalization to store it. You can DISPLAY it simply by using

    =[ComboNameHere].[Column](1)

    provided that the combo's row source has the name and that the combo's column count property is set to the number of columns in the rowsource.

  3. #3
    hlogoma is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2011
    Posts
    7
    Quote Originally Posted by boblarson View Post
    Why are you storing the name and the ID in the table? You should ONLY be storing the ID in the table. The Employees table already has the name so you would be violating the rules of normalization to store it. You can DISPLAY it simply by using

    =[ComboNameHere].[Column](1)

    provided that the combo's row source has the name and that the combo's column count property is set to the number of columns in the rowsource.
    Hi Bob,

    Thanks for your reply .... I will look into this to see if it is giving me the runtime error.

    Tom.

  4. #4
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Quote Originally Posted by boblarson View Post
    ....
    the number of columns in the rowsource.
    Hi Bob, welcome Sir, is this your first post to the forum? my title has been changed in the Access World Forum to Newly Registered user

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by khalid View Post
    Hi Bob, welcome Sir, is this your first post to the forum? my title has been changed in the Access World Forum to Newly Registered user
    Yes, this was my first post here. And as far as the title goes, you should still be able to go into your CP and set the custom user title. Just don't use the last one you used

  6. #6
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Hahaha bob, I know I will be kicked off this time if I use it again , and I have heard that you are giving AWF VIP title to some beloved hmmm

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

Similar Threads

  1. Replies: 2
    Last Post: 06-13-2011, 06:04 PM
  2. Replies: 5
    Last Post: 12-27-2010, 06:59 PM
  3. Use combobox to control Subform
    By bundy75 in forum Forms
    Replies: 2
    Last Post: 09-22-2010, 03:31 AM
  4. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  5. Replies: 0
    Last Post: 12-16-2009, 01:14 PM

Tags for this Thread

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