Need some advices on changing combo box rowsource at runtime

B

Bon

Hello all

The combo box will be disappeared after I selected a value and move the
cursor to another record in continous form.

I created a form which has a GroupDescription textbox, GroupID textbox
and a TeamLeaderNumber combo box. The textbox is used to show Group
name and the combo box contains a list of team members in selected
group. One of them will be assigned to be Team Leader using the combo
box. Textbox and Combo box data are from query.

Two tables I got - tblGroups and tblGroup_Members
tblGroups contains GroupID, GroupDescription and TeamLeaderNumber
fields
tblGroup_Members contains MemberNumber and GroupID

The GroupDescription textbox's control source = GroupDescription
The TeamLeaderNumber Combo box's control source = TeamLeaderNumber
The GroupID textbox's control source = GroupID
Form's RecordSource = "SELECT * FROM tblGroups"

I put the following statements under Form_Current() method:
Me.TeamLeaderNumber.RowSource = "SELECT MembersNumber FROM
tblGroup_Members WHERE GroupID = " & Me.GroupID.value & "'"
Me.TeamLeaderNumber.ColumnCount = 1
Me.TeamLeaderNumber.ColumnWidth = "1 cm"
Me.TeamLeaderNumber.BoundColumn = 1

When I move my cursor to Group1 record for example and select a team
member as team leader in the combo box, the selected team member in
combo box will be disappeared if I move my cursor to Group2 record.

Please give me some advices.

Best regards,
Bon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top