itchyII
MIS
- Apr 10, 2001
- 167
Hello All,
I have an Access 2000 database. I have a form that schedules events and on it I have a combo box that is populated by a query. The query filters out any team names that are already assigned to an event at the selected time (another box on the form that gets populated before my combo box). I have a listbox below all of this that displays all the events that have been created and when you double click on the event, it loads it up into the boxes above, so that you can make any necessary changes. The problem is that once you create an event a t a certain time, it the team name gets filtered out of the combo box and when my code tries to place the name back in the combo box for display, I get a ‘not in the list’ error. So I thought that I’d simply change the LimitToList property to False before loading the name back in the box, which, in theory should fix my problem. But now I’m getting an error that the db ‘can’t set the LimitToList property to no right now”. Why not??? Is there something that I have to do before setting the LimitToList property?
Thanks
ItchyII
I have an Access 2000 database. I have a form that schedules events and on it I have a combo box that is populated by a query. The query filters out any team names that are already assigned to an event at the selected time (another box on the form that gets populated before my combo box). I have a listbox below all of this that displays all the events that have been created and when you double click on the event, it loads it up into the boxes above, so that you can make any necessary changes. The problem is that once you create an event a t a certain time, it the team name gets filtered out of the combo box and when my code tries to place the name back in the combo box for display, I get a ‘not in the list’ error. So I thought that I’d simply change the LimitToList property to False before loading the name back in the box, which, in theory should fix my problem. But now I’m getting an error that the db ‘can’t set the LimitToList property to no right now”. Why not??? Is there something that I have to do before setting the LimitToList property?
Code:
Private Sub EventList_DblClick(Cancel As Integer)
Dim item As Variant
'find selected item
For item = 0 To Me.EventList.ListCount - 1
If Me.EventList.Selected(item) Then
Me.eventKey_hidden = Me.EventList.Column(0, item)
Me.StartTime = Format((Me.EventList.Column(2, item)), "hh:mm")
Me.EndTime = Format((Me.EventList.Column(3, item)), "hh:mm")
Me.IceSurface = Me.EventList.Column(4, item)
Me.Event = Me.EventList.Column(5, item)
If Me.EventList.Column(5, item) = "Partie/Game" Or Me.EventList.Column(5, item) = "Partie Finale/Final Game" Then
Me.Pool.Visible = True
Me.Pool_Label.Visible = True
Me.Pool.SetFocus
Me.Pool.Text = Me.EventList.Column(6, item)
Me.TeamA.Visible = True
Me.TeamA_Label.Visible = True
Me.TeamA.Requery
Me.TeamA.LimitToList = False
Me.TeamA.SetFocus
Me.TeamA.Text = Me.EventList.Column(7, item)
Me.TeamB.Visible = True
Me.TeamB_Label.Visible = True
Me.TeamB.Requery
Me.TeamB.LimitToList = False
Me.TeamB.SetFocus
Me.TeamB.Text = Me.EventList.Column(8, item)
Else
Me.Pool.Visible = False
Me.Pool_Label.Visible = False
Me.TeamA.Visible = False
Me.TeamA_Label.Visible = False
Me.TeamB.Visible = False
Me.TeamB_Label.Visible = False
End If
item = Me.EventList.ListCount - 1
End If
Next item
End Sub
Thanks
ItchyII