Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Focus Combo Box problems

Discussion in 'Information Technology' started by lmv, Oct 29, 2005.

  1. lmv

    lmv
    Expand Collapse
    Guest

    1) Form opens with focus in cldtable. I have combobox in the header and need
    the form to open with focus there. (I've checked tab order that isn't
    problem. And tab stop is YES)

    also, I can't tab from (details section) cldtable to header...

    2)When focus (only by mouse click) is in the combo box you can scroll by
    entering text or using arrow keys BUT when you get to the item you want ENTER
    OR TAB changes the info in the box, fills the fields on the form, but the
    combo box doesn't close UNTIL you ENTER again.

    3)If there is an apostrophe in the name it will show up in the combo box
    (fixed that with)
    rs.FindFirst "[NameOfPublication] = ' " & Replace(Me![List11], " ' ", " ' '
    ") & " ' "

    BUT it will not populate the fields in the form. It just jumps back to the
    start of the combo list.

    WOE IS ME! I have searched extensively on this board to no avail... can
    anyone help?
     
  2. Loading...


  3. RuralGuy

    RuralGuy
    Expand Collapse
    Guest

    Use the Form_Load event to Me.ComboBox.SetFocus

    I usually put a barely perceptable transparent TextBox 1 pixel x 1 pixel with a
    SetFocus to the control I want in the GotFocus event of the small TextBox. It
    is usually 1st or last in the tab order and allows me to set focus where ever I
    choose, including in a header or footer where you need another barely visible
    textbox to be able to tab back to the detail section of the form.

    You can also resolve the apostrophe problem with:
    rs.FindFirst "[NameOfPublication] = """ & Me![List11] & """
    (that is 3 DoubleQuotes either side of the target)
    Or another method:
    rs.FindFirst "[NameOfPublication] = " & chr(34) & Me![List11] & chr(34) & "

    By design the tab key does not move you between the Header, Detail and Footer
    sections of a form.

    What other code is in the AfterUpdate event of the ComboBox or where ever you
    have that FindFirst.

    On Fri, 28 Oct 2005 14:13:04 -0700, lmv <lmv@discussions.microsoft.com> wrote:

    >1) Form opens with focus in cldtable. I have combobox in the header and need
    >the form to open with focus there. (I've checked tab order that isn't
    >problem. And tab stop is YES)
    >
    >also, I can't tab from (details section) cldtable to header...
    >
    >2)When focus (only by mouse click) is in the combo box you can scroll by
    >entering text or using arrow keys BUT when you get to the item you want ENTER
    >OR TAB changes the info in the box, fills the fields on the form, but the
    >combo box doesn't close UNTIL you ENTER again.
    >
    >3)If there is an apostrophe in the name it will show up in the combo box
    >(fixed that with)
    >rs.FindFirst "[NameOfPublication] = ' " & Replace(Me![List11], " ' ", " ' '
    >") & " ' "
    >
    >BUT it will not populate the fields in the form. It just jumps back to the
    >start of the combo list.
    >
    >WOE IS ME! I have searched extensively on this board to no avail... can
    >anyone help?

    _______________________________________________
    hth - RuralGuy (RG for short)
    Please post to the NewsGroup so all may benefit.
     
  4. lmv

    lmv
    Expand Collapse
    Guest

    Question #1 Thank You!
    > Use the Form_Load event to Me.ComboBox.SetFocus

    worked!

    (by the way what is the difference between Me. or Me! ...)

    > I usually put a barely perceptable transparent TextBox 1 pixel x 1 pixel...


    I had done this but ... made it invisible and I think it stopped working...
    but that part is ok now.

    #2 problem is still there: The combobox when I get to the choice and hit
    enter it doesn't close the box and move to the tinytext box to force it to
    the sub form... until I hit enter again?

    #3 Resolved Thank You!

    BUT another part of that problem is
    I have 4 different records with the same name / different addresses. It will
    only fill the name and info of the 1st record even if I scroll or click
    another record that has the same name. (Any suggestions)

    > By design the tab key does not move you between the Header, Detail and Footer
    > sections of a form.
    >
    > What other code is in the AfterUpdate event of the ComboBox or where ever you
    > have that FindFirst.


    Set rs = Me.Recordset.Clone
    rs.FindFirst "[CategoryID] = " & Str(Nz(Me![cboCategoryID_Lookup], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    ExitProc:
    Exit Sub

    This is the only thing in AfterUpdate Thanks for your help!!
     
  5. RuralGuy

    RuralGuy
    Expand Collapse
    Guest

    You are very welcome. Answered in line.

    On Sat, 29 Oct 2005 18:41:03 -0700, lmv <lmv@discussions.microsoft.com> wrote:

    >Question #1 Thank You!
    >> Use the Form_Load event to Me.ComboBox.SetFocus

    >worked!
    >
    > (by the way what is the difference between Me. or Me! ...)


    Truthfully I still don't know for sure, sorry. Search on Bang v Dot.

    >
    >> I usually put a barely perceptable transparent TextBox 1 pixel x 1 pixel...

    >
    >I had done this but ... made it invisible and I think it stopped working...
    >but that part is ok now.
    >
    >#2 problem is still there: The combobox when I get to the choice and hit
    >enter it doesn't close the box and move to the tinytext box to force it to
    >the sub form... until I hit enter again?


    Do you have the same results with the tab key? How do you have the enter key
    action defined? Tools>Options>Keyboard tab (Move after enter) section.

    >
    >#3 Resolved Thank You!
    >
    >BUT another part of that problem is
    >I have 4 different records with the same name / different addresses. It will
    >only fill the name and info of the 1st record even if I scroll or click
    >another record that has the same name. (Any suggestions)


    You should be searching for the ComboBox selection based on a unique field. Your
    AfterUpdate code is avoiding a Null so I'm not sure what is going on there. I
    would expect the bound column to *always* have the unique value I need. If not
    then maybe the RowSource of the ComboBox needs some adjustment. You can get to
    any column of data in the ComboBox with Me.ComboBoxName.Column(n) where 'n' is a
    zero based index (column 1 is index 0). I can't give more detailed advice
    without knowing more about your RowSource of the ComboBox or bound RecordSource
    of the form.

    >
    >> By design the tab key does not move you between the Header, Detail and Footer
    >> sections of a form.
    >>
    >> What other code is in the AfterUpdate event of the ComboBox or where ever you
    >> have that FindFirst.

    >
    >Set rs = Me.Recordset.Clone
    > rs.FindFirst "[CategoryID] = " & Str(Nz(Me![cboCategoryID_Lookup], 0))
    > If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    >ExitProc:
    > Exit Sub
    >
    >This is the only thing in AfterUpdate Thanks for your help!!

    _______________________________________________
    hth - RuralGuy (RG for short)
    Please post to the NewsGroup so all may benefit.
     
  6. lmv

    lmv
    Expand Collapse
    Guest

    More about:
    #2 problem: The combobox when I get to the choice and hit
    > >enter it doesn't close the box and move to the tinytext box to force it to
    > >the sub form... until I hit enter again?


    >Do you have the same results with the tab key?

    YES

    >How do you have the enter key action defined?
    >Tools>Options>Keyboard tab (Move after enter) section.


    Next Field
    --------------------

    >BUT another part of that problem is
    >I have 4 different records with the same name / different addresses. It will
    >only fill the name and info of the 1st record even if I scroll or click
    >another record that has the same name. (Any suggestions)

    ---------------Your response:
    You should be searching for the ComboBox selection based on a unique field.
    Your
    AfterUpdate code is avoiding a Null so I'm not sure what is going on there. I
    would expect the bound column to *always* have the unique value I need. If
    not
    then maybe the RowSource of the ComboBox needs some adjustment. You can get
    to any column of data in the ComboBox with Me.ComboBoxName.Column(n) where
    'n' is a zero based index (column 1 is index 0). I can't give more detailed
    advice without knowing more about your or bound RecordSource of the form.
    ----------------My answer
    There is no control source because it is unbound combobox (in the header)

    RowSource of the ComboBox is:
    SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New
    Supplier].City FROM [Add New Supplier];

    Bound Column is 1

    I am pretty new to this so... Me.ComboBoxName.Column(n) goes under what event?
    Thanks!!
     
  7. RuralGuy

    RuralGuy
    Expand Collapse
    Guest

    Answered in line:

    On Sun, 30 Oct 2005 20:23:01 -0800, lmv <lmv@discussions.microsoft.com> wrote:

    >More about:
    >#2 problem: The combobox when I get to the choice and hit
    >> >enter it doesn't close the box and move to the tinytext box to force it to
    >> >the sub form... until I hit enter again?

    >
    >>Do you have the same results with the tab key?

    >YES


    How about with the mouse? This one has me stumped. Mine move to the next
    control on Enter, Tab or mouse click.

    When you go to the Event tab of the property sheet for the ComboBox, how many
    events have something in them and what is it? You need to post code from:
    Private Sub...
    ..
    ..
    End Sub

    >
    >>How do you have the enter key action defined?
    >>Tools>Options>Keyboard tab (Move after enter) section.

    >
    >Next Field
    >--------------------
    >
    >>BUT another part of that problem is
    >>I have 4 different records with the same name / different addresses. It will
    >>only fill the name and info of the 1st record even if I scroll or click
    >>another record that has the same name. (Any suggestions)

    >---------------Your response:
    >You should be searching for the ComboBox selection based on a unique field.
    >Your
    >AfterUpdate code is avoiding a Null so I'm not sure what is going on there. I
    >would expect the bound column to *always* have the unique value I need. If
    >not
    >then maybe the RowSource of the ComboBox needs some adjustment. You can get
    >to any column of data in the ComboBox with Me.ComboBoxName.Column(n) where
    >'n' is a zero based index (column 1 is index 0). I can't give more detailed
    >advice without knowing more about your or bound RecordSource of the form.
    >----------------My answer
    >There is no control source because it is unbound combobox (in the header)
    >
    >RowSource of the ComboBox is:
    >SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New
    >Supplier].City FROM [Add New Supplier];


    Do you have a PrimaryKey field you could add to this RowSource? Maybe an
    AutoNumber field like CompanyID?

    >
    >Bound Column is 1
    >
    >I am pretty new to this so... Me.ComboBoxName.Column(n) goes under what event?
    >Thanks!!


    It would go in the AfterUpdate searching code but let's wait for some more
    answers 1st.
    _______________________________________________
    hth - RuralGuy (RG for short)
    Please post to the NewsGroup so all may benefit.
     
  8. lmv

    lmv
    Expand Collapse
    Guest

    Answered in line:
    More about:
    >#2 problem: The combobox when I get to the choice and hit
    >> >enter it doesn't close the box and move to the tinytext box to force it

    to
    >> >the sub form... until I hit enter again?


    >>Do you have the same results with the tab key?

    >YES


    > How about with the mouse?

    If I click on a choice with the mouse it drops that choice in the box, box
    stays open and it highlight autot scrolls down 8 in the list

    > When you go to the Event tab of the property sheet for the ComboBox, how many
    > events have something in them and what is it? You need to post code from:

    only code for cbo is as follows

    Private Sub cboCategoryID_Lookup_AfterUpdate()
    ' Find the record that matches the control.
    On Error GoTo ProcError
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[CategoryID] = " & Str(Nz(Me![cboCategoryID_Lookup], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    ExitProc:
    Exit Sub
    ProcError:
    MsgBox "Error: " & Err.Number & ". " & Err.Description
    Resume ExitProc
    End Sub>
    -------------------------------------------------------
    Private Sub cboCategoryID_Lookup_Enter()
    Me.cboCategoryID_Lookup.Dropdown
    End Sub
    -------------------------------------------------------

    >
    >>How do you have the enter key action defined?
    >>Tools>Options>Keyboard tab (Move after enter) section.


    > >Next Field

    --------------------

    >>BUT another part of that problem is
    >>I have 4 different records with the same name / different addresses. It will
    >>only fill the name and info of the 1st record even if I scroll or click
    >>another record that has the same name. (Any suggestions)

    >---------------Your response:
    >You should be searching for the ComboBox selection based on a unique field.
    >Your
    >AfterUpdate code is avoiding a Null so I'm not sure what is going on

    there. I
    >would expect the bound column to *always* have the unique value I need. If
    >not
    >then maybe the RowSource of the ComboBox needs some adjustment. You can

    get
    > >to any column of data in the ComboBox with Me.ComboBoxName.Column(n) where
    > >'n' is a zero based index (column 1 is index 0). I can't give more detailed
    > >advice without knowing more about your or bound RecordSource of the form.
    > >----------------My answer
    > >There is no control source because it is unbound combobox (in the header)
    > >
    > >RowSource of the ComboBox is:
    > >SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New Supplier].City FROM [Add New Supplier];

    >
    > Do you have a PrimaryKey field you could add to this RowSource? Maybe an
    > AutoNumber field like CompanyID?


    The RowSource of the ComboBox is: a query... I tried adding

    SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New
    Supplier].City FROM [Add New Supplier];SupplierID FROM [Add New Supplier]

    but it didn't change anything forget it I am going to just change the
    company name to no dup and give them unique names... It's too complicated for
    me! But, still would like to figure out why enter doesn't send focus to next
    ....

    Thanks!
     
  9. RuralGuy

    RuralGuy
    Expand Collapse
    Guest

    I think you gave up too soon on the lookup. We were almost there. You will
    need to address this problem sometime in the future anyway. It is always better
    to do lookups on unique values.

    As for the double enter problem, try commenting out the OnEnter event code and
    see what happens.

    On Mon, 31 Oct 2005 15:31:02 -0800, lmv <lmv@discussions.microsoft.com> wrote:

    >Answered in line:
    >More about:
    > >#2 problem: The combobox when I get to the choice and hit
    > >> >enter it doesn't close the box and move to the tinytext box to force it

    >to
    > >> >the sub form... until I hit enter again?

    >
    >>>Do you have the same results with the tab key?

    >>YES

    >
    >> How about with the mouse?

    >If I click on a choice with the mouse it drops that choice in the box, box
    >stays open and it highlight autot scrolls down 8 in the list
    >
    >> When you go to the Event tab of the property sheet for the ComboBox, how many
    >> events have something in them and what is it? You need to post code from:

    >only code for cbo is as follows
    >
    >Private Sub cboCategoryID_Lookup_AfterUpdate()
    > ' Find the record that matches the control.
    > On Error GoTo ProcError
    > Dim rs As Object
    >
    > Set rs = Me.Recordset.Clone
    > rs.FindFirst "[CategoryID] = " & Str(Nz(Me![cboCategoryID_Lookup], 0))
    > If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    >ExitProc:
    > Exit Sub
    >ProcError:
    > MsgBox "Error: " & Err.Number & ". " & Err.Description
    > Resume ExitProc
    >End Sub>
    >-------------------------------------------------------
    >Private Sub cboCategoryID_Lookup_Enter()
    > Me.cboCategoryID_Lookup.Dropdown
    >End Sub
    >-------------------------------------------------------
    >
    > >
    >>>How do you have the enter key action defined?
    >>>Tools>Options>Keyboard tab (Move after enter) section.

    >
    >> >Next Field

    >--------------------
    >
    >>>BUT another part of that problem is
    >>>I have 4 different records with the same name / different addresses. It will
    >>>only fill the name and info of the 1st record even if I scroll or click
    >>>another record that has the same name. (Any suggestions)

    > >---------------Your response:
    > >You should be searching for the ComboBox selection based on a unique field.
    > >Your
    > >AfterUpdate code is avoiding a Null so I'm not sure what is going on

    >there. I
    > >would expect the bound column to *always* have the unique value I need. If
    > >not
    > >then maybe the RowSource of the ComboBox needs some adjustment. You can

    >get
    >> >to any column of data in the ComboBox with Me.ComboBoxName.Column(n) where
    >> >'n' is a zero based index (column 1 is index 0). I can't give more detailed
    >> >advice without knowing more about your or bound RecordSource of the form.
    >> >----------------My answer
    >> >There is no control source because it is unbound combobox (in the header)
    >> >
    >> >RowSource of the ComboBox is:
    >> >SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New Supplier].City FROM [Add New Supplier];

    >>
    >> Do you have a PrimaryKey field you could add to this RowSource? Maybe an
    >> AutoNumber field like CompanyID?

    >
    >The RowSource of the ComboBox is: a query... I tried adding
    >
    >SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New
    >Supplier].City FROM [Add New Supplier];SupplierID FROM [Add New Supplier]
    >
    >but it didn't change anything forget it I am going to just change the
    >company name to no dup and give them unique names... It's too complicated for
    >me! But, still would like to figure out why enter doesn't send focus to next
    >...
    >
    >Thanks!

    _______________________________________________
    hth - RuralGuy (RG for short)
    Please post to the NewsGroup so all may benefit.
     
  10. lmv

    lmv
    Expand Collapse
    Guest

    > I think you gave up too soon on the lookup. We were almost there.

    ok RG, let's keep going then. Tell me what to do... so let say the
    CompanyName (dups OK) is Lowe's and there are 4 of them in different
    lcoations. Cities (dupsOK) Nodups on address. SupplierID is key nodups...

    >You will need to address this problem sometime in the future anyway. It is >always better to do lookups on unique values.


    Crud now the apostrophe isn't working again!

    Anyway So, if I highlight Lowes it will populate the form... but if I click
    on the next Lowes it won't BUT IF I use next cmdkey or previous I put in the
    form it will go to the next record which is the next Lowes... (this is why I
    gave up... I am so confused)

    > As for the double enter problem, try commenting out the OnEnter event code and
    > see what happens.


    Sorry...I don't know what that means...

    Thank you for the help you gave if you are bored with this question I
    understand!
    lmv


    > On Mon, 31 Oct 2005 15:31:02 -0800, lmv <lmv@discussions.microsoft.com> wrote:
    >
    > >Answered in line:
    > >More about:
    > > >#2 problem: The combobox when I get to the choice and hit
    > > >> >enter it doesn't close the box and move to the tinytext box to force it

    > >to
    > > >> >the sub form... until I hit enter again?

    > >
    > >>>Do you have the same results with the tab key?
    > >>YES

    > >
    > >> How about with the mouse?

    > >If I click on a choice with the mouse it drops that choice in the box, box
    > >stays open and it highlight autot scrolls down 8 in the list
    > >
    > >> When you go to the Event tab of the property sheet for the ComboBox, how many
    > >> events have something in them and what is it? You need to post code from:

    > >only code for cbo is as follows
    > >
    > >Private Sub cboCategoryID_Lookup_AfterUpdate()
    > > ' Find the record that matches the control.
    > > On Error GoTo ProcError
    > > Dim rs As Object
    > >
    > > Set rs = Me.Recordset.Clone
    > > rs.FindFirst "[CategoryID] = " & Str(Nz(Me![cboCategoryID_Lookup], 0))
    > > If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    > >ExitProc:
    > > Exit Sub
    > >ProcError:
    > > MsgBox "Error: " & Err.Number & ". " & Err.Description
    > > Resume ExitProc
    > >End Sub>
    > >-------------------------------------------------------
    > >Private Sub cboCategoryID_Lookup_Enter()
    > > Me.cboCategoryID_Lookup.Dropdown
    > >End Sub
    > >-------------------------------------------------------
    > >
    > > >
    > >>>How do you have the enter key action defined?
    > >>>Tools>Options>Keyboard tab (Move after enter) section.

    > >
    > >> >Next Field

    > >--------------------
    > >
    > >>>BUT another part of that problem is
    > >>>I have 4 different records with the same name / different addresses. It will
    > >>>only fill the name and info of the 1st record even if I scroll or click
    > >>>another record that has the same name. (Any suggestions)
    > > >---------------Your response:
    > > >You should be searching for the ComboBox selection based on a unique field.
    > > >Your
    > > >AfterUpdate code is avoiding a Null so I'm not sure what is going on

    > >there. I
    > > >would expect the bound column to *always* have the unique value I need. If
    > > >not
    > > >then maybe the RowSource of the ComboBox needs some adjustment. You can

    > >get
    > >> >to any column of data in the ComboBox with Me.ComboBoxName.Column(n) where
    > >> >'n' is a zero based index (column 1 is index 0). I can't give more detailed
    > >> >advice without knowing more about your or bound RecordSource of the form.
    > >> >----------------My answer
    > >> >There is no control source because it is unbound combobox (in the header)
    > >> >
    > >> >RowSource of the ComboBox is:
    > >> >SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New Supplier].City FROM [Add New Supplier];
    > >>
    > >> Do you have a PrimaryKey field you could add to this RowSource? Maybe an
    > >> AutoNumber field like CompanyID?

    > >
    > >The RowSource of the ComboBox is: a query... I tried adding
    > >
    > >SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New
    > >Supplier].City FROM [Add New Supplier];SupplierID FROM [Add New Supplier]
    > >
    > >but it didn't change anything forget it I am going to just change the
    > >company name to no dup and give them unique names... It's too complicated for
    > >me! But, still would like to figure out why enter doesn't send focus to next
    > >...
    > >
    > >Thanks!

    > _______________________________________________
    > hth - RuralGuy (RG for short)
    > Please post to the NewsGroup so all may benefit.
    >
     
  11. RuralGuy

    RuralGuy
    Expand Collapse
    Guest

    Answered in line:
    On Tue, 1 Nov 2005 10:57:03 -0800, lmv <lmv@discussions.microsoft.com> wrote:

    >> I think you gave up too soon on the lookup. We were almost there.

    >
    >ok RG, let's keep going then. Tell me what to do... so let say the
    >CompanyName (dups OK) is Lowe's and there are 4 of them in different
    >lcoations. Cities (dupsOK) Nodups on address. SupplierID is key nodups...


    Great, I'm with you.

    >
    >>You will need to address this problem sometime in the future anyway. It is >always better to do lookups on unique values.

    >
    >Crud now the apostrophe isn't working again!
    >
    >Anyway So, if I highlight Lowes it will populate the form... but if I click
    >on the next Lowes it won't BUT IF I use next cmdkey or previous I put in the
    >form it will go to the next record which is the next Lowes... (this is why I
    >gave up... I am so confused)
    >
    >> As for the double enter problem, try commenting out the OnEnter event code and
    >> see what happens.

    >
    >Sorry...I don't know what that means...


    See below.

    >
    >Thank you for the help you gave if you are bored with this question I
    >understand!
    >lmv
    >
    >
    >> On Mon, 31 Oct 2005 15:31:02 -0800, lmv <lmv@discussions.microsoft.com> wrote:
    >>
    >> >Answered in line:
    >> >More about:
    >> > >#2 problem: The combobox when I get to the choice and hit
    >> > >> >enter it doesn't close the box and move to the tinytext box to force it
    >> >to
    >> > >> >the sub form... until I hit enter again?
    >> >
    >> >>>Do you have the same results with the tab key?
    >> >>YES
    >> >
    >> >> How about with the mouse?
    >> >If I click on a choice with the mouse it drops that choice in the box, box
    >> >stays open and it highlight autot scrolls down 8 in the list
    >> >
    >> >> When you go to the Event tab of the property sheet for the ComboBox, how many
    >> >> events have something in them and what is it? You need to post code from:
    >> >only code for cbo is as follows
    >> >
    >> >Private Sub cboCategoryID_Lookup_AfterUpdate()
    >> > ' Find the record that matches the control.
    >> > On Error GoTo ProcError
    >> > Dim rs As Object
    >> >

    > Set rs = Me.Recordset.Clone
    > rs.FindFirst "[CategoryID] = " & Str(Nz(Me![cboCategoryID_Lookup], 0))


    We need to change the previous line so it will look for our new SupplierID

    rs.FindFirst "[SupplierID] = " & Me!cboCategoryID_Lookup.Column(0)

    Hopefully there is a SupplierID field in the bound query/table


    > If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    >> >ExitProc:
    >> > Exit Sub
    >> >ProcError:
    >> > MsgBox "Error: " & Err.Number & ". " & Err.Description
    >> > Resume ExitProc
    >> >End Sub>

    >-------------------------------------------------------
    >Private Sub cboCategoryID_Lookup_Enter()


    Just put a single tick ' in front of the next line
    ' Me.cboCategoryID_Lookup.Dropdown '-- A tick turns the line into a comment

    >End Sub
    >-------------------------------------------------------
    >> >
    >> > >
    >> >>>How do you have the enter key action defined?
    >> >>>Tools>Options>Keyboard tab (Move after enter) section.
    >> >
    >> >> >Next Field
    >> >--------------------
    >> >
    >> >>>BUT another part of that problem is
    >> >>>I have 4 different records with the same name / different addresses. It will
    >> >>>only fill the name and info of the 1st record even if I scroll or click
    >> >>>another record that has the same name. (Any suggestions)
    >> > >---------------Your response:
    >> > >You should be searching for the ComboBox selection based on a unique field.
    >> > >Your
    >> > >AfterUpdate code is avoiding a Null so I'm not sure what is going on
    >> >there. I
    >> > >would expect the bound column to *always* have the unique value I need. If
    >> > >not
    >> > >then maybe the RowSource of the ComboBox needs some adjustment. You can
    >> >get
    >> >> >to any column of data in the ComboBox with Me.ComboBoxName.Column(n) where
    >> >> >'n' is a zero based index (column 1 is index 0). I can't give more detailed
    >> >> >advice without knowing more about your or bound RecordSource of the form.
    >> >> >----------------My answer
    >> >> >There is no control source because it is unbound combobox (in the header)
    >> >> >
    >> >> >RowSource of the ComboBox is:
    >> >> >SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New Supplier].City FROM [Add New Supplier];
    >> >>
    >> >> Do you have a PrimaryKey field you could add to this RowSource? Maybe an
    >> >> AutoNumber field like CompanyID?
    >> >
    >> >The RowSource of the ComboBox is: a query... I tried adding
    >> >

    >SELECT [Add New Supplier].CompanyName, [Add New Supplier].Address, [Add New
    >Supplier].City FROM [Add New Supplier];SupplierID FROM [Add New Supplier]


    Change the SELECT so the SupplierID is the first field:

    SELECT [Add New Supplier].SupplierID, [Add New Supplier].CompanyName, _
    [Add New Supplier].Address,[Add New Supplier].City FROM [Add New Supplier];

    Change the Column Count property on the format tab of the ComboBox property
    sheet to 4 and the Column Widths 1st column to 0"; and play with List Width ans
    Colomn Widths 'til you like it.

    >
    >> >but it didn't change anything forget it I am going to just change the
    >> >company name to no dup and give them unique names... It's too complicated for
    >> >me! But, still would like to figure out why enter doesn't send focus to next
    >> >...
    >> >
    >> >Thanks!

    >> _______________________________________________
    >> hth - RuralGuy (RG for short)
    >> Please post to the NewsGroup so all may benefit.
    >>

    _______________________________________________
    hth - RuralGuy (RG for short)
    Please post to the NewsGroup so all may benefit.
     

Share This Page