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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox Selection

Status
Not open for further replies.

janetlyn

Technical User
Jan 29, 2003
516
US
A form opens with a combobox, textbox, and label button. The combobox window drops down showing the choices available, but when someone actually clicks on a choice it does not fill in the combobox.

Here is the code behind the form:

Private Sub Form_Activate()
DoCmd.SelectObject A_FORM, "FRM-CodeCombo"
DoCmd.Restore
End Sub
'FRM-CodeCombo is the name of the form opening.

Private Sub Form_Load()
Me![CodeComboBox].SetFocus
Me![CodeComboBox].Dropdown
End Sub
'CodeComboBox is the name of the combobox.

'Allows the selection of the combobox to open a query which will supply the information to the report.
Private Sub btnPrint_Click()
DoCmd.OpenReport "RPT-CodeDates", acViewPreview
Me!btnPrint.SpecialEffect = 2
Me!btnPrint.SpecialEffect = 1
End Sub
Private Sub btnPrint_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me!btnPrint.SpecialEffect = 2
End Sub
Private Sub btnPrint_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me!btnPrint.SpecialEffect = 1
End Sub

In the properties of the combobox:

Control Source is blank
Row Source Type is Table/Query
Row Source is 'QRY-Code' which is correct.
Column count is 2.
Column Heads is No
Bound Column is 1.
Limit to List is Yes.

If there is a property I did not show here that is important please let me know.

So, why will it not allow a selection to be made from the dropdown of the combobox? Thanks, JL
 
Janetlyn-your problem lies in the fact that you have nothing selected for your control source. You need to have the source that you are drawing the selected data from. If you click on "Control Source" you should be able to click on the down arrow and look to see what is available and then just choose one. This should then make it so people can select items from the combo box.

Hope this helps,
Phil
 
When I click on the control source, it is blank and there is nothing to choose from. The data to choose from in the combo box is coming from a query.
 
Ok, what I would do would be delete the combo box that you currently have and start over. Then in the toolbox make sure that the wizard is off and click on the field list button (next to the toolbox button). Then all you have to do is select the combo box icon out of the tool box and just click on the field in the field list that you want and drag it into the form. After this you will need to change the combo box properties back to Table\Query or Value List if you want to type in the selections that you would like available under "Row Source".

That should do it, hope this helps
Phil
 
Let me know if you're still having problems with it and I can help you get through it.

Phil
 
In order to get a control source, wouldn't I have to bind the form?
 
Yep, that is what you are doing by selecting the field that you want the combo box to be binded to and dragging it into the form. By doing this you should be binding the form and the field name should appear in the "control source" property.

Phil
 
Okay, I bound it to the query. At least now the first record appears in the combobox, but it still will not allow me to choose one of the items in the drop down box.

I have a report that when chosen, opens a QRY-Code Details, which has a field called ILCodeNumber. Under the Criteria for that is [Forms]![FRM-CodeCombo]![CodeComboBox].

Duh! When I make a selection (if I could) I would then select a Print button which is the code in my first box of the thread. I notice it does not reference the form FRM-CodeDetails at all, but instead just the combobox form itself. Could this be part of the problem?

Thanks for your patience, JL
 
Is there any way that you could change your Row Source Type to a Value List and then manually type in all of the choices (in the Row Source) that you would like people to select from or are they too numerous? If you were able to do this I think it may solve your problem.

Let me know,
Phil
 
There are 20 items and the names are pretty long. Plus, if we add code, then that name would need to be added to the list. If I am not the person running the program, that will not know how to be done.
 
The only thing that I can think of is that maybe something went wrong when we were creating the box. So what I would do would be go back and try making one with the wizard on. (Select the field name and the combo box icon and drag it onto the form.) Maybe the wizard prompts will solve your problem instead of maually doing it.

Let me know if this works,
Phil
 
So you don't think that the fact that my report which is calling the combobox selection not actually mentioning putting the selection into its (the reports) query in my code above is not the problem? I only ask, because I did your suggestion and redid one creating the wizard and neither worked. JL
 
Now that I think about it that could, in all likelyhood, be the problem but I would not be person to give you any suggestions on that. Sorry I could not be of more help.

Phil
 
Okay thanks for trying Phil. Hopefully someone will pick up the thread again. Appreciate you trying though. JL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top