Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Has anybody used comboboxes like this?

Status
Not open for further replies.

LaurelLee

Programmer
Mar 2, 2004
117
0
0
US
I have recently been thrown back into the wonderful world of Access after a brief break, and have inherited a Db. It is a fairly straightforward applicant tracking db for and HR dept.

On the form used for inputting new applicants into the db, I have encountered something curious. When the previous developer created combo boxes, he stacked a text box underneath the combobox. The combobox is populated through a bit of SQL, and the text box is underneath, bound to the column in the table.

Here is the code for the text box:
Code:
Private Sub Action_Click()

    Me.cboAction.Visible = True
    Me.cboAction.SetFocus
    Me.cboAction.Dropdown
    
End Sub
and here is the code for the combobox
Code:
Private Sub cboAction_Click()

    Me.Action = Me.cboAction.Text
    Me.Action.SetFocus
    Me.cboAction.Visible = False
    
End Sub

I just don't understand why this is necessary, and why I have a run-time error when I click an option in the combobox; Candidate Tracking(Form) can't move the focus to the control action (action in the text box).


I am a bit of a dolt when it comes to this stuff, so please excuse me and chastise me all you want if this is elementary.

Thanks a bunch!

___________________________________________________________
With your thoughts you create the world--Shakyamuni Buddha
 
It looks to me like they wanted to eliminate the arrow from the combo box by putting in a text box. Then when the user clicks the text box, they get the drop dow from the combo box.

Is that what you needed or do you need more info?
 
Okay, that is what is going on here. But do you see why there would be an error occurring when a selection was made? The debugger highlights the line Me.Action.SetFocus when it happens. I don't want to mess with this form very much, as I have other things to do in the Db, but it looks like I may make it simpler to avoid these errors.

Thanks for your help!

___________________________________________________________
With your thoughts you create the world--Shakyamuni Buddha
 
Sorry, I will have to look into it further. I will let you know tomorrow.
 
How are ya LaurelLee . . . . .

First, [blue]Action[/blue] ia a property for an [blue]OLE Object[/blue]. So this may be a case where the dot operator signifies the wrong thing. Let me know what happens with the following (changes are in [purple]purple[/purple]):
Code:
[blue]    Me[purple][b]![/b][/purple]Action = Me[purple][b]![/b][/purple]cboAction.Text
    Me[purple][b]![/b][/purple]Action.SetFocus
    Me[purple][b]![/b][/purple]cboAction.Visible = False[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top