Hi
I have been able to do this code to update a table which feeds a table which provides information to a combo box.
The first part works fine, it asks if you want to add it and adds it to the underlying table"addq" but the added value does not appear in the dropdown list and therefore cannot be selected
I presume that i have managed to mess up the refresh statement
Here is the code (Access2000)
Private Sub QuestionNumberlist_NotInList(NewData As String, Response As Integer)
'Adds a question number that is not in the list to the list, if the user wishes to do so.
Dim strMessage As String
Dim intAnswer As Integer
strMessage = "'" & [NewData] & "' is currently not in your list. Do you wish to add it?"
intAnswer = MsgBox(strMessage, vbOKCancel + vbQuestion)
If intAnswer = 1 Then
Set dbsVBA = CurrentDb
Set rstKeyWord = dbsVBA.OpenRecordset("Addq")
rstKeyWord.AddNew
rstKeyWord!Questionnumber = [NewData]
rstKeyWord.Update
Me.Refresh
Response = acDataErrAdded
Response = acDataErrDisplay
End If
End Sub
Thanks in anticipation
Sarah
I have been able to do this code to update a table which feeds a table which provides information to a combo box.
The first part works fine, it asks if you want to add it and adds it to the underlying table"addq" but the added value does not appear in the dropdown list and therefore cannot be selected
I presume that i have managed to mess up the refresh statement
Here is the code (Access2000)
Private Sub QuestionNumberlist_NotInList(NewData As String, Response As Integer)
'Adds a question number that is not in the list to the list, if the user wishes to do so.
Dim strMessage As String
Dim intAnswer As Integer
strMessage = "'" & [NewData] & "' is currently not in your list. Do you wish to add it?"
intAnswer = MsgBox(strMessage, vbOKCancel + vbQuestion)
If intAnswer = 1 Then
Set dbsVBA = CurrentDb
Set rstKeyWord = dbsVBA.OpenRecordset("Addq")
rstKeyWord.AddNew
rstKeyWord!Questionnumber = [NewData]
rstKeyWord.Update
Me.Refresh
Response = acDataErrAdded
Response = acDataErrDisplay
End If
End Sub
Thanks in anticipation
Sarah