Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Aug 2002
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Report only from form (Access 2000)

    How can i prevent opening a report by itself,and allow opening only through
    the form Frm1? Also,it it possible to prevent opening the report in design view?

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Report only from form (Access 2000)

    Hmmmmmmmmm

    From what you're saying, you or your users have access to the database window.
    Ok for you, but not so good if you don't want your users in there.

    I think you need to check out Access Security and also how to convert your database to an MDE file, thus preventing the users opening in design view.

    Now to open the form only from frm1, you could use a Command Button wizard to open a report, but if you have a unique identifier, lets say an ID or some kind of Reference on your form, you could set this as the Criteria behind the Query running the Report (thats if you use a query)

    If this doesn't make sense to you, you'll have to post back with a little more of a specific post so we can advise you further.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open Report only from form (Access 2000)

    You could check whether the form is open. The following function is from the Northwind database, it returns true if strFormName is open in datasheet or form view:

    Function IsFormLoaded(ByVal strFormName As String) As Integer
    Const conObjStateClosed = 0
    Const conDesignView = 0
    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
    If Forms(strFormName).CurrentView <> conDesignView Then
    IsFormLoaded = True
    End If
    End If
    End Function

    You can use this in the On Open event of the report:

    Private Sub Report_Open(Cancel As Integer)
    Cancel = Not IsFormLoaded("Frm1")
    End If

    To prevent users from opening the report in design view, you can set startup options for the database to hide the database window (this can be bypassed by holding the Shift key down while opening the database, but this use of the Shift key can be disabled), or you can set user-level security, or you can create an MDE database, as mentioned by Dave Willett.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •