Results 1 to 2 of 2
  1. #1
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37

    Problem filling textboxes from combobox

    Hey, I am new to access and have a quick question.

    I created a combobox that draws data (Workorder, Quantity, Country of origin, Customer) from a table with this info. When I select the workorder I want the other textboxes that I have to autofill with the other information from that certain workorder (quantity, COO, and customer).

    I have the following code written to do this:

    Private Sub Combo98_AfterUpdate()

    OQT.SetFocus
    Me!OQT.Text = Me!Combo98.Column(1)
    JCO.SetFocus
    Me!JCO.Text = Me!Combo98.Column(2)
    CN.SetFocus
    Me!CN.Text = Me!Combo98.Column(3)



    End Sub

    I added the set focus because when I first atempted to run it an error message popped up stating that the specified field could not be edited without focus. After that change was made I ran it again and this time an error message popped up saying that the field could not be changed because it is read only.

    Please help me out with this
    Thanks

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    You syntax should be:
    Me.txtBoxName = Me.comboBoxName.Column(Integer) 'Note the first column is 0, not 1.
    assuming both controls are on the same form, which I assume is the case seeing as though you are already using "Me".

    There should be no need for setFocus.

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

Similar Threads

  1. Filling a combobox with field names.
    By millerdav99 in forum Access
    Replies: 1
    Last Post: 04-26-2011, 02:09 PM
  2. Sorting by combobox problem
    By wsurritte in forum Access
    Replies: 11
    Last Post: 02-28-2011, 02:11 PM
  3. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  4. Replies: 0
    Last Post: 12-16-2009, 01:14 PM
  5. Combobox problem
    By newitsupport in forum Access
    Replies: 1
    Last Post: 09-26-2009, 01:03 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