Can anyone tell me why all of a sudden my 2010 Access database is not recognizing a key field in one of my tables? VBA recognizes every other field defined in the table? I've double and triple checked that everything is spelled correctly.
Code where compile error appears:
Me.benefitID = Nz(DMax("benefitID", "tblBenefits"), 0) + 1
tblBenefits fields:
benefitID (Primary key)
benefitAnimalWelfare
benefitSafety
benefitCostSavings
benefitImprovedPractice
benefitAdministrative
benefitOther
Entire code:
Private Sub NewIdeaButton_Click()
On Error GoTo NewIdeaButton_Click_Err
'new idea boolean is true
newIdea = True
On Error Resume Next
DoCmd.GoToRecord , "", acNewRec
'assign IDs for ideaID, benefitID, statusID
Me.ideaID = Nz(DMax("ideaID", "tblIdeaDetails"), 0) + 1
Me.benefitID = Nz(DMax("benefitID", "tblBenefits"), 0) + 1
Me.statusID = Nz(DMax("statusID", "tblStatus"), 0) + 1
Me.PrintIdeaButton.Visible = False
Me.DeleteIdeaButton.Visible = False
Me.IdeaStatusFormButton.Visible = False
Me.CancelButton.Visible = True
Me.ClearListBoxButton.Visible = False
Me.AttachedLabel.Visible = False
Me.FileList.Visible = False
Me.FileList.RowSourceType = "Value List"
Me.ideaSubmitter.SetFocus
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
NewIdeaButton_Click_Exit:
Me.NewIdeaButton.Visible = False
Exit Sub
NewIdeaButton_Click_Err:
MsgBox Error$
Resume NewIdeaButton_Click_Exit
End Sub
I've tried selecting the Microsoft DAO 3.6 Object Library Reference, but I receive a "Name conflicts with existing module, project, or object library". I read that if you deselect the Microsoft Office 14.0 Object Library, it'll take care of that error. But I don't think this is something I want to deselect?
I've also tried deleting the relationship between this table and another, renaming the field, resetting the primary key to a different field, it still won't recognize this field.
Also tried a compact and repair database, but got the message "The compact and repair operation has been canceled. You might not have adequate permissions to the folder that the database is located in. You need full permission to the directory the database is located to compact and repair. Contact your system administrator for more information." I've been able to run a C & R in the past?