Results 1 to 15 of 15
  1. #1
    crombiecrunch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    15

    having one text area unlocked while the rest are locked on form

    Hello all



    I have a form that when a regular user opens they have access to submit a "new" case so all fields are unlocked to them. When the regular user does a search for a previous case and the information is displayed the fields are locked to them from edits. There is a group of users that do have access to change any of the fields on the form after the data is submitted.

    I do however want to open one field to all the users that is called 'Description'

    The code I am using to unlock the form to the authorized group is below, but i cant figure out how to add to it to just unlock the Description field to everyone.

    Code:
    Private Sub Form_Load()
    Me.AllowEdits = True
    If Forms!Login!cboUser.Column(4) < 3 Then
    Dim ctl As Control
    On Error Resume Next
    For Each ctl In Me.Controls
      If ctl.Tag <> "skip" Then
      ctl.Locked = True
      End If
       Err.Clear
    Next ctl
    End If
    End Sub
    anyone able to help.


    Another question is there any examples of creating reports using combobox to select the required data? For example I want to select from the following; "Status", "Date Range" under status there will be 5 options to choose from then under date range i want them to be able to select within last 7 days, 30 days, 4 months, etc and then click on run report and have the report pull that data

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Perhaps something along these lines:



    If ctl.Tag <> "skip" And ctl.Name <> "Description" Then
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    crombiecrunch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    15
    oh that worked! But now I noticed another error I have on it. Before I had that code in there I just had the form properties sent to allowedits = no which allowed the normal users to enter the new case information ok.

    Now with the above code I can not enter any data on a new case.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Why not change that back to yes?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    crombiecrunch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    15
    Quote Originally Posted by pbaldy View Post
    Why not change that back to yes?
    I tried that, changing it back to yes still does not allow anyone under the access level of 3 to enter data on a new blank form.

    This is what I am trying to achieve:

    General user opens the claim form and can enter data in to all of the fields.
    General user displays a previous claim all fields but the description field is locked to edits.

    Any user set to say access level 4 can modify the form fully.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What's the Allow Additions property?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    crombiecrunch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    15
    all set to yes

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I guess I'm not clear on the problem, but the solution would be a logical combination of setting the properties of the form and controls based on the user level. Perhaps the problem is that you don't have an Else clause to set the properties if the user is not <3?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    crombiecrunch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    15
    yes sorry i have very limited knowledge about access as you can see.

    So with out the above code and with the form set to allow additions, deletions, and edits to no, any user can open a new form and enter data in to it and save it. If veiwing and previous cases the forms is locked and users can not edit any of the fields.

    i am trying to get it so that general users can add new data to a blank record but can not modify any of that data to an existing record with the exception of the description field.

    then at the same time uses with a higher access can modify any of the fields on an exisiting form

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You might try this line of code for the general users:

    Me.DataEntry = True

    which should display a new record and not have previous records available. If it doesn't work in the load event, I'd change the code that opens the form to do it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    crombiecrunch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    15
    that didnt work either. might have to go about it another way but not sure how

  12. #12
    crombiecrunch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    15
    so i changed the code a bit to the following

    Code:
    Private Sub Form_Load()
    If Me.Dirty = False Then
    Me.AllowEdits = True
    End If
    If Me.Dirty = True Then
    If Forms!Login!cboUser.Column(4) < 3 Then
    Dim ctl As Control
    On Error Resume Next
    For Each ctl In Me.Controls
      If ctl.Tag <> "skip" And ctl.Name <> "Description" Then
      ctl.Locked = True
      End If
      
       Err.Clear
    Next ctl
    End If
    End If
    End Sub
    So now when I open a new form i can enter in the data ok. but its now ignores the code to lock the fields when displaying a record and all fields can be changed/edit.

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The form will never be dirty in the load event. Dirty means the user has changed something.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    crombiecrunch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    15
    ya. I might have to scrap my thinking on this one.

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    For the report, can use a parameterized query (I don't) http://datapigtechnologies.com/flash...mtoreport.html

    or use VBA to construct filter string and pass it to report with the WHERE CONDITION argument of DoCmd.OpenReport
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Detail area of form help
    By Darkmatter5 in forum Forms
    Replies: 1
    Last Post: 07-10-2012, 04:28 PM
  2. Replies: 5
    Last Post: 06-28-2012, 10:49 AM
  3. Replies: 0
    Last Post: 04-22-2011, 04:58 AM
  4. Help with subforms (and the rest)
    By Franco27 in forum Reports
    Replies: 0
    Last Post: 03-14-2011, 09:43 AM
  5. Combox not filling the rest of the form
    By britt britt in forum Forms
    Replies: 2
    Last Post: 10-27-2009, 04:55 AM

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