D
David Wetmore
I wish to move search terms from a combobox into a list box. I also want to be able
to use the Not In List event to add a new search term to the combo box and list box. My combo box,
cboD1, has a query as a row source, SELECT tblDescriptors.Dkey, tblDescriptors.Name
FROM tblDescriptors WHERE (Class=1) And (FLAG=0) ORDER BY tblDescriptors.Name. The bound
column is column 1, tblDescriptors.Name.
My not in list routine is:
Private Sub cboD1_NotInList(NewData As String, response As Integer)
If (GoodDescriptor(NewData) = True) Then
response = acDataErrAdded
Call DPool.AddRecord(NewData, 1, cboD1, lstD1)
Else
response = acDataErrContinue
End If
End Sub 'cboD1_NotInList
"GoodDescriptor" just makes sure the string entered in the combobox is valid.
DPool.AddRecord is:
Public Sub AddRecord(strName As String, intClass As Integer, CBox As ComboBox, LBox As ListBox)
mrstDescriptorSet.Open
With mrstDescriptorSet
.AddNew
!Name = strName
!RefCount = 1
!Class = intClass
!Flag = 1
.Update
End With
LBox.AddItem (CStr(mrstDescriptorSet!DKey) & ";" & strName)
mrstDescriptorSet.Close
CBox.Requery
End Sub 'AddRecord
When I run, the CBox.Requery raises error 2118, "must save current field before requery" and, when I close
the form, the usual non in list message. BUT when I open the form and look in the combo box, the descriptor I just
added is there.
What am I doing wrong?
to use the Not In List event to add a new search term to the combo box and list box. My combo box,
cboD1, has a query as a row source, SELECT tblDescriptors.Dkey, tblDescriptors.Name
FROM tblDescriptors WHERE (Class=1) And (FLAG=0) ORDER BY tblDescriptors.Name. The bound
column is column 1, tblDescriptors.Name.
My not in list routine is:
Private Sub cboD1_NotInList(NewData As String, response As Integer)
If (GoodDescriptor(NewData) = True) Then
response = acDataErrAdded
Call DPool.AddRecord(NewData, 1, cboD1, lstD1)
Else
response = acDataErrContinue
End If
End Sub 'cboD1_NotInList
"GoodDescriptor" just makes sure the string entered in the combobox is valid.
DPool.AddRecord is:
Public Sub AddRecord(strName As String, intClass As Integer, CBox As ComboBox, LBox As ListBox)
mrstDescriptorSet.Open
With mrstDescriptorSet
.AddNew
!Name = strName
!RefCount = 1
!Class = intClass
!Flag = 1
.Update
End With
LBox.AddItem (CStr(mrstDescriptorSet!DKey) & ";" & strName)
mrstDescriptorSet.Close
CBox.Requery
End Sub 'AddRecord
When I run, the CBox.Requery raises error 2118, "must save current field before requery" and, when I close
the form, the usual non in list message. BUT when I open the form and look in the combo box, the descriptor I just
added is there.
What am I doing wrong?