Results 1 to 6 of 6

Thread: 'simple' frustrating task

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    'simple' frustrating task

    Hi Im currently developing a database but I cant seem to fathom a seemingly simple problem.

    I have a form on the form is a combo box I want it so that when you select an item from this box and then click a button the selection is then added into a text box to create a list. However I keep getting a focus error - "Run-time error '2185' You can't reference a property or method for a control unless the control has the focus.

    The code Im using looks like this -

    Text36.Text = DropDownList1.Text and is attached to the buttons on click event.

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: 'simple' frustrating task

    On what line do you get the error?

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    Re: 'simple' frustrating task

    I get the error on the line I posted

    Text36.Text = DropDownList1.Text

    text 36 is the text box and drop down list 1 is the combo box.

    the whole block looks like this

    Private Sub BtnSubmit_Click()
    Text36.Text = DropDownList1.Text
    End Sub
    Last edited by midgetron; Aug 5th, 2005 at 09:33 AM. Reason: adding more code

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: 'simple' frustrating task

    Are you using VB or VBA?

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    Re: 'simple' frustrating task

    when i go into the about it just says Microsoft Visual Basic 6.3

    there is some other information including VBA: Retail 6.3.8863 along with a version number and other additional information.

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    4

    Re: 'simple' frustrating task

    Ah I have it working now by using getfocus, however each time theres a new selection it deletes the old one - which I dont want it to do.

    The code now looks like this:

    Code:
    Private Sub Command38_Click()
    
    DropDownList1.SetFocus
    sTemp = DropDownList1.Text
    Text36.SetFocus
    Text36.Text = sTemp
    End Sub
    I was thinking an array might solve my problem ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width