DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: Help with Error 3027

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Help with Error 3027

    [Originally posted by Mehdi Benyebka]

    An error pops up (Error 3027), when my program tries to delete a record from the recordset. The error says that it the file or database is Read-only. I have checked the permissions and all of them were set properly. I am new to visual basic, and it might something obvious in the code that I am missing (?). Find below a copy of my program.

    Thanks a lot

    Mehdi.

    -----------------------------------------------

    Private Sub Command0_Click()

    Dim db As Database
    Dim rs As Recordset

    Dim sw, sy, Rls, Pass As String
    Dim VarBookmark As Variant
    Dim Count As Integer
    Dim tid As Integer

    Set db = CurrentDb

    Set rs = db.OpenRecordset("Query4", dbOpenDynaset)

    With rs

      If .Bookmarkable = False Then
      Debug.Print "Recordset is not Bookmarkable!"
      Else
    .MoveFirst
    .MoveLast
    Count = .RecordCount
    Debug.Print "Record count ="; Count

    .MoveFirst

    Debug.Print "1st = "; !TestID; !CfgNameID; !TestDateTime

    tid = !TestID

    Debug.Print "TESTID="; tid

    .FindFirst "[TestID]=148"

     
      If .NoMatch Then
     
      MsgBox "RESULTS: NoT FOUND"
     
      Else
     
      MsgBox "FOUND"
      Debug.Print !TestID, !CfgNameID; !TestDateTime
     
      VarBookmark = .Bookmark
     
      End If
     
      Do Until .EOF
     
    .FindNext "([TestID] = " & !TestID & _
    "And [CfgNameID] = '" & !CfgNameID & "'" & _
    "And TestDateTime > #" & !TestDateTime & "#)"
     
     

    If .NoMatch Then

    Debug.Print "Current Record="; !TestID; !CfgNameID; !TestDateTime

     
    DeleteRecord rs, !TestID


    Debug.Print "DELETED RECORDS="; !TestID; !CfgNameID; !TestDateTime

    .MoveNext

    Debug.Print "FOLLOWING RECORD ="; !TestID; !CfgNameID; !TestDateTime


    Debug.Print "DONE"

    Exit Do
    Else

    Debug.Print "Eureka !"
    Debug.Print !TestID; !CfgNameID; !TestDateTime


    '.Bookmark = VarBookmark
    'Debug.Print "The first record ="; !TestID; !CfgNameID

    End If
     
    Loop

    End If

    'DoCmd.OutputTo acOutputTable, "rs!TestID", acFormatRTF, "c:\mb.rtf", True
    End With
    rs.Close

    End Sub

    Sub DeleteRecord(rstTemp As Recordset, _
    lngSeek As Long)

    With rstTemp
    .FindFirst "TestID=" & lngSeek

    If .NoMatch Then
    MsgBox "No test ID #" & lngSeek & " in file!"
    Else
    .Delete
    MsgBox "Record for Test ID #" & lngSeek & _
    " deleted!"
    End If
    End With

    End Sub




  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Help with Error 3027

    [Originally posted by FreeVBCode.com]

    Your code looks right to me. You are opening a dynaset, which in DAO is an updatable recordset. Are you sure the NT file permissions are set to allow modification of the file?

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Help with Error 3027

    [Originally posted by Ed Ardzinski]

    Forgive my ignorance of the Deug.Print object/method...I've never used it. But could there be a conflict in the With block? The interpreter might be trying to look for a Print method in the recordset, rather than the Debug object.

    Sorry I don't have enough time to play with this and find out more; got a promotion at work and have to learn a new platform (Magic), plus finish off some pending work. I'll be busy for a while.

    Good luck!

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Help with Error 3027

    [Originally posted by Mehdi Benyebka]

    Thank you for the reply. I checked with our system administrator and he said that I have write permissions to the database. I might be able to resolve this if I know where the Query dynaset is being stored.
    How can I find this information?

    I am also using Windows 95 and not NT.

    Thank you for your help,

    Mehdi.

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Help with Error 3027

    [Originally posted by FreeVBCode.com]

    Well it looks like you are using access which I am less familiar with though the code is straight DAO with which I do know and seems right.

    Maybe e-mail me the database and if I have time I will take a quick look to see if I have the same problem. If I can get it to work, we will know it is a matter of configuration/permissions.

  6. #6
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Help with Error 3027

    [Originally posted by Mehdi Benyebka]

    I inserted the following piece of code in the program:

    ' Enumerate Containers collection and display the current
    ' user and the permissions set for that user.
    For Each ctrLoop In db.Containers

    With ctrLoop
    Debug.Print "Container: " & .Name
    Debug.Print "User: " & .UserName
    Debug.Print " Permissions: " & .Permissions
    Debug.Print " AllPermissions: " & _
    .AllPermissions
    End With
    Next ctrLoop

    The output in the debug window was the following:

    Container: Databases
    User: mb
    Permissions: 0
    AllPermissions: 0
    Container: Forms
    User: mb
    Permissions: 0
    AllPermissions: 1048575
    Container: Modules
    User: mb
    Permissions: 0
    AllPermissions: 1048575
    Container: Relationships
    User: mb
    Permissions: 0
    AllPermissions: 1048575
    Container: Reports
    User: mb
    Permissions: 0
    AllPermissions: 1048575
    Container: Scripts
    User: mb
    Permissions: 0
    AllPermissions: 1048575
    Container: SysRel
    User: mb
    Permissions: 0
    AllPermissions: 1048575
    Container: Tables
    User: mb
    Permissions: 0
    AllPermissions: 1048575

    Do you know what 'Permissions ' and 'AllPermissions' are supposed to be set to?

    Also I do not see the permissions for the queries (?)

    Thank you very much,

    Mehdi.

  7. #7
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:Help with Error 3027

    [Originally posted by FreeVBCode.com]

    I have a feeling you are on the right track; however, like I said, I am not an Access programmer and am not familiar with the Containers object which is part of the Access Object model.

    My suggestion is to search the MSDN knowledge base and library and I'm pretty sure you'll come across more information about this.

  8. #8
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Help with Error 3027

    [Originally posted by bob maddock]

    see the following:

    http://support.microsoft.com/support/kb/articles/Q209/9/43.asp

    http://www.helpmate.net/download/prb00009.pdf

    Hope it helps...having the same problem with my access97 dbs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center