Hello All Happy New Year,
I am having trouble with a application I started last summer (this app keeps biting back at me). I had to modify my original project to a FE/BE access2010/sqlserver2008, so I have been fixing and repairing what doesn't seem to work.
The issue I am working on at the moment is fixing a particular editing option.
Code:
Private Sub btnSubmitSMEUPDATE_Click()
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim rs2 As DAO.Recordset
Dim rid As Long
On Error GoTo ErrorHandler
Set db = CurrentDb()
Set rs1 = db.OpenRecordset("tbl_AVUM_Scored_Data", dbOpenDynaset, dbSeeChanges)
Set rs2 = db.OpenRecordset("tbl_SME_AVUM_Edit", dbOpenDynaset, dbSeeChanges)
Set ctl = Forms!frm_TaskList_Popup!List2
With rs1
.AddNew
!EI_ID = Forms!frm_Acft_Score!EI_ID
!Event_Date = Forms!frm_Acft_Score!Event_Date
!Event_No = Forms!frm_Acft_Score!Event_No
!Sys_Code = Forms!frm_Acft_Score!Sys_Code
!IETM_ID = ctl
.Update
.Bookmark = .LastModified
rid = !Record_ID
End With
Set ctl2 = Forms!Test1_AVUM_frm_SME_Update!lboAVUMSMEUpdate
With rs2
.AddNew
!Record_ID = rid
!Maint_Funct = Forms!Test1_AVUM_frm_SME_Update!cboSMEMFo1
!MOS_ID = Forms!Test1_AVUM_frm_SME_Update!cboSMEMOSo1
!Time = Forms!Test1_AVUM_frm_SME_Update!txboSMETimeo1
!Comments = Forms!Test1_AVUM_frm_SME_Update!txboSMEAVUMComments
.Update
End With
ExitHandler:
Set ctl = Nothing
Set ctl2 = Nothing
Set rs1 = Nothing
Set rs2 = Nothing
Me.lboAVUMSMEUpdate.Requery
Me.lboAVUMSMEUpdate = ""
Me.cboSMEMFo1.Requery
Me.cboSMEMFo1 = ""
Me.cboSMEMOSo1.Requery
Me.cboSMEMOSo1 = ""
Me.txboSMETimeo1.Requery
Me.txboSMETimeo1 = ""
Me.txboSMEAVUMComments.Requery
Me.txboSMEAVUMComments = ""
[Forms]![Test1_AVUM_frm_SME_Update].Requery
[Forms]![frm_Acft_Score].[sfrm_AVUM_Scored_Data].Requery
[Forms]![frm_Acft_Score].[qryTest2 subform].Requery
Exit Sub
ErrorHandler:
Select Case Err
Case Else
MsgBox Err.Description
DoCmd.Hourglass False
Resume ExitHandler
End Select
End Sub
This is tied to a table in SQl Server
Code:
CREATE TABLE [dbo].[tbl_SME_AVUM_Edit](
[Record_ID] [int] NULL,
[Maint_Funct] [int] NULL,
[MOS_ID] [nvarchar](255) NULL,
[Time] [real] NULL,
[Comments] [nvarchar](255) NULL,
[Date Added] [datetime] NULL
This record only gets created when a user he/she edits exisiting Time, MOS or Maint Function and there is a Comment box to explain why the edit was needed.
When I step through the vba code I keep getting sent to the error handler at the line "With rs2, .AddNew". The error message is "MS ACCESS Error Can Not Update. Object Is Read Only"....I am looking at the permissions on the SQL Server database and have added the users who are going to us the application with "Select,Connect,Update,Insert,Read,Delete" premission also db_datareader, and db_datawriter....
I am not sure what else to chk.....anyhelp would be greatly appreciated
Thanks again.