Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Dom606 (IS/IT--Management)
27 Feb 09 10:39
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:

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
TheAceMan1 (Programmer)
28 Feb 09 10:42
How are ya Dom606 . . .

There's alot that can be asked about this (espcially not knowing the setup), but as as a first stab:

Quote (TheAceMan1):

Are you entering a new record in a subform without entering data in the new record of the mainform?

See Ya! .  .  .  .  .  .

Be sure to see thread181-473997: How To Get Good Answers To Your Questions  Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer?  Worthy Reading! thumbsup2
                 

Dom606 (IS/IT--Management)
28 Feb 09 11:09
Thanks for the reply Ace Man. I am still baffeled.  I have a tabbed form with 5 tabs.  Each tab has a form.  The one that is causing me problems is listed above.  The first field is cboSkillCategory.  When I click on it, the drop down displays the correct data.  As soon as I select one of the options, the commit error pops up.
TheAceMan1 (Programmer)
28 Feb 09 19:16
Dom606 . . .

Your talking subForms here ... not forms.

Are the subforms linked to the mainform?

Your Thoughts? . . .

See Ya! .  .  .  .  .  .

Be sure to see thread181-473997: How To Get Good Answers To Your Questions  Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer?  Worthy Reading! thumbsup2
                 

Dom606 (IS/IT--Management)
28 Feb 09 19:22
Yes, by EmployeeID
TheAceMan1 (Programmer)
28 Feb 09 19:59
How are ya kronar . . .

I keep getting the impression your using an ADO Data Set. Let me know if this true.

In any case, referencing the subform depends on which code module the code is running in. If its running in the mainform try:

CODE

   If Me.Dirty Then Me.Dirty = False 'Save the current record
   [TimebyDate].Form.Requery
... else if its running in the subform try:

CODE

   If Me.Dirty Then Me.Dirty = False 'Save the current record[/green]
   Me.Requery
Your Thoughts? . . .

See Ya! .  .  .  .  .  .

Be sure to see thread181-473997: How To Get Good Answers To Your Questions  Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer?  Worthy Reading! thumbsup2
                 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close