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

Access Combo Box - Can't display desired default

Status
Not open for further replies.

Larry1216

Technical User
Nov 14, 2002
13
I have a combo box based on a table going to files for different users.

Wish to display a particular person in the combo box
"Order" field is set as primary but the first record MP is not displayed - another record is instead.

Thanks for Input - did not see this specific item in knowledge base.

Order Reviewer Initials
1 MP
2 EV
3 GR
4 GJ
5 MH
6 SR



 
Tables are not guaranteed to appear in primary key order. I think it is best to add a sort ascending to the field in the query design screen invoked from the properties page for the combo box.
 
Assuming you have set the combobox's BoundColumn property to 1, try the following code in your Form_Load event:
Code:
Private Sub Form_Load()
    
    'Select default 
    If cboMyCombo.ListCount > 0 Then
        cboMyCombo = 1
    End If

End Sub

But Remou's might be the better suggestion.
 
Implemented Remou's suggestion on the "row source" line of Control Properties but unfortunately it does not work although it should!

ThankJoes suggestion is beyond my limited technical abilties.

Thanks to both of you for making suggestions. /LMc
 
How are ya Larry1216 . . .

Post the [blue]RowSource[/blue] . . .

Calvin.gif
See Ya! . . . . . .
 
Row Source = SELECT [Reference 04 MRR Reviewers].[Order], [Reference 04 MRR Reviewers].[Reviewer Name] FROM [Reference 04 MRR Reviewers]

Reviewer Name is what is displayed in the form - the control source is another field with a unique code for each reviewer. "ReviewerCode"

Thanks/ LMc
 
Larry1216 . . .

[blue]RowSource[/blue] should be:
Code:
[blue]SELECT [Order], [Reviewer Name] FROM [Reference 04 MRR Reviewers] ORDER BY [Order];[/blue]

If the above doesn't work please answer all the following:
[ol][li] Is MP in the table [Reference 04 MRR Reviewers]?[/li]
Larry1216 said:
[blue]Reviewer Name is what is displayed in the form - [purple]the control source is another field with a unique code for each reviewer. "ReviewerCode"[/purple][/blue]
[li]In the above quote if the listbox is bound to a field it should display [Order] values! If this is not so, be more specific about this issue.[/li][/ol]

Out of curiosity . . .
Larry1216 said:
[blue]I have a combo box based on a table going to files for different users.[/blue]
Be more specific here too . . .

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

Part and Inventory Search

Sponsor

Back
Top