Results 1 to 2 of 2
  1. #1
    cementblocks is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    6

    Programmatically make queries read-only.


    I have constructed a form that allows users to create custom queries. I would like to make these queries read-only. My normal method for making a query read-only is to set the recordset type property to 'snapshot', but I can't seem to be able to set this property programmatically. Any suggestions would be appreciated.

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Below is a code that is attached to the command button of a Form. This Code is used to create a Query. The Query is then opened as Read-only.


    Private Sub Command0_Click()
    On Error GoTo Err_Command0_Click
    Dim strSQL As String
    Dim qdf As Object
    strSQL = "SELECT cat.DivisionCatagory, cat.Division_cat FROM cat;"
    Set qdf = CurrentDb.CreateQueryDef("Operations", strSQL)
    DoCmd.OpenQuery "Operations", acViewNormal, acReadOnly

    Exit_Command0_Click:
    Exit Sub

    Err_Command0_Click:
    MsgBox Err.Description
    Resume Exit_Command0_Click

    End Sub

    Mark the thread solved if this solves your problem.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Programmatically add a field to an existing table
    By lpdds in forum Database Design
    Replies: 2
    Last Post: 11-10-2009, 12:45 PM
  2. How Can I Modify the currency symbol programmatically
    By migo702000 in forum Programming
    Replies: 5
    Last Post: 11-03-2009, 04:34 AM
  3. Change Row Background Color Programmatically
    By sales@4bco.com in forum Programming
    Replies: 2
    Last Post: 10-25-2009, 11:17 AM
  4. Add descriptions for make table queries
    By HurrMark in forum Access
    Replies: 0
    Last Post: 12-30-2008, 08:29 AM
  5. Replies: 2
    Last Post: 10-19-2006, 04:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums