Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2005

Tip: Looking for answers? Try searching our database.

cannot update. Database or object is read-only

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sandy - 24 Jul 2005 14:23 GMT
I have this annoying bug that is driving me up the wall.  This code used to
work but has suddenly stopped.  When a user closes the report, if they answer
Yes to the prompt, I want a field called Invoiced to be set to true.

If anyone can help, I'd really appreciate it.

The code I am using is:

Private Sub Report_Close()
   
   Dim strMess As String
   Dim rs As Recordset
   Dim rsInvNo As Recordset
   
   If Not blnReprint Then
       strMess = "Would you like to mark the displayed dockets as
Invoiced?" & vbLf
       strMess = strMess & "If you select Yes, you will not be able to
invoice these dockets again."
       
       If MsgBox(strMess, vbYesNo + vbQuestion, gstrAppName) = vbYes Then
           If glngCustomerID > -1 Then
               Set rs = DBEngine(0)(0).OpenRecordset("SELECT * from
qryInvoice WHERE DocketDate between #" & getStartDate() & "# and #" &
getEndDate() & "# AND CustomerID = " & getCustID())
           Else
               Set rs = DBEngine(0)(0).OpenRecordset("SELECT * from
qryInvoice WHERE DocketDate between #" & getStartDate() & "# and #" &
getEndDate() & "# AND CustomerID <> 6")
           End If
           While Not rs.EOF
               rs.Edit
               rs!Invoiced = True
               rs.Update
               rs.MoveNext
           Wend
       End If
   End If
   
End Sub

Regards
Sandy
Sandy - 24 Jul 2005 16:01 GMT
I found a solution.  I replaced the OpenRecordset code with DoCmd.RunSQL and
it works fine now.

> I have this annoying bug that is driving me up the wall.  This code used to
> work but has suddenly stopped.  When a user closes the report, if they answer
[quoted text clipped - 39 lines]
> Regards
> Sandy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.