Hell again,
this code is attached to a combo box on my form. the code works fine but (there is always a but) it requerys my entire form which changes the recordset. Any ideas on how to make it either just requery the combo box, not requery the combo box till the entire record is saved or bring focus back to the current record.
thanks
Private Sub PMS_NotInList(NewData As String, Response As Integer)
Dim db As Database, rs As Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available Practice management"
strMsg = strMsg & "@Do you wish to add it to the list?"
strMsg = strMsg & "@Click Yes to Enter new data or No to re-type it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new category?"
= vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblpms", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!PMS = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
End Sub
this code is attached to a combo box on my form. the code works fine but (there is always a but) it requerys my entire form which changes the recordset. Any ideas on how to make it either just requery the combo box, not requery the combo box till the entire record is saved or bring focus back to the current record.
thanks
Private Sub PMS_NotInList(NewData As String, Response As Integer)
Dim db As Database, rs As Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available Practice management"
strMsg = strMsg & "@Do you wish to add it to the list?"
strMsg = strMsg & "@Click Yes to Enter new data or No to re-type it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new category?"
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblpms", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!PMS = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
End Sub