Hi everyone,
I have a Tabbed form that has been working fine. Now when I select a specific tab and try to enter a new record, I get the following error:
The value cannot be added to this new row until the row has been committed. Commit the row first, and then try adding the value.
I have no idea how to commit a new row! If someone can tell me how to do that it will be much appreciated.
Here is the code behind the tabbed form, if that helps. The field I am trying to add data to is cboSkillCategory:
I have a Tabbed form that has been working fine. Now when I select a specific tab and try to enter a new record, I get the following error:
The value cannot be added to this new row until the row has been committed. Commit the row first, and then try adding the value.
I have no idea how to commit a new row! If someone can tell me how to do that it will be much appreciated.
Here is the code behind the tabbed form, if that helps. The field I am trying to add data to is cboSkillCategory:
Code:
Option Compare Database
Option Explicit
Private Sub cboSkillCategory_AfterUpdate()
Me.cboSkills = 0
Me.cboSkills.Requery
End Sub
Private Sub cboSkillCategory_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_cboSkillCategory_NotInList
Dim intAnswer As Integer
intAnswer = MsgBox("Value not in lookup table. Edit table?", vbYesNo, vbQuestion)
If intAnswer = vbYes Then
DoCmd.RunCommand acCmdUndo
DoCmd.OpenForm "frmSkillCategory", acNormal, , , acFormEdit, acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
Exit_cboSkillCategory_NotInList:
Exit Sub
Err_cboSkillCategory_NotInList:
MsgBox Err.Description
Resume Exit_cboSkillCategory_NotInList
End Sub
Private Sub cboSkills_AfterUpdate()
Me.txtSkill.Requery
End Sub
Private Sub cboSkills_GotFocus()
If Len(Trim(Nz(cboSkillCategory, "") & "")) = 0 Then
MsgBox "Please Specify Category first"
cboSkillCategory.SetFocus
Else
Me.cboSkills.Requery
End If
End Sub
Private Sub cboSkills_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_cboSkills_NotInList
Dim intAnswer As Integer
intAnswer = MsgBox("Value not in lookup table. Edit table?", vbYesNo, vbQuestion)
If intAnswer = vbYes Then
DoCmd.RunCommand acCmdUndo
DoCmd.OpenForm "frmSkilltblSkills", acNormal, , , acFormEdit, acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
Exit_cboSkills_NotInList:
Exit Sub
Err_cboSkills_NotInList:
MsgBox Err.Description
Resume Exit_cboSkills_NotInList
End Sub
'------------------------------------------------------------
' cmdPreviewReport_Click
'
'------------------------------------------------------------
Private Sub cmdPreviewReport_Click()
On Error GoTo cmdPreviewReport_Click_Err
Forms![frmEmployee Details].Visible = False
DoCmd.OpenReport "rptSillEvaluation", acViewPreview, "", "", acNormal
cmdPreviewReport_Click_Exit:
Exit Sub
cmdPreviewReport_Click_Err:
MsgBox Error$
Resume cmdPreviewReport_Click_Exit
End Sub
'Private Sub Form_Dirty(Cancel As Integer)
'If Me.Dirty Then Me.Dirty = False
'End Sub
Private Sub Form_Load()
If IsNull(cboSkillCategory) Then
cboSkillCategory = Me.cboSkillCategory.ItemData(0)
Call cboSkillCategory_AfterUpdate
End If
End Sub
Private Sub Form_Current()
Me.cboSkills.Requery
End Sub