Results 1 to 14 of 14
  1. #1
    jlyalls is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    19

    Open up a form as Readonly but want to be able to use Navigation entry that I built.

    Hey guys, I have been working on a new database with a few tables. I have built a form that allows the users to enter in the record number that will take them to the proper entry they are wanting to view. I have set this up to open as read only and this creates an issue for me. The users are not able to utilize the navigation. My question is...is there anyway to do open the form with readonly but allow them to type in the navigation field (Go to VLAN Record) to go to the record they are looking for?

    Here is an image

    Click image for larger version. 

Name:	Form_View_VLAN_Data.PNG 
Views:	39 
Size:	17.4 KB 
ID:	24455

    Here is my code

    Option Compare Database
    Option Explicit


    Private Sub Command1_Click()
    Dim userlevel As Integer


    If IsNull(Me.txtLoginID) Then
    MsgBox "Please Enter LoginID", vbInformation, "LoginID Required"
    Me.txtLoginID.SetFocus
    ElseIf IsNull(Me.txtPassword) Then
    MsgBox "Please Enter Password", vbInformation, "Password Required"
    Me.txtPassword.SetFocus
    Else


    'process the job
    If (IsNull(DLookup("[UserLogin]", "tblUser", "[Userlogin] ='" & Me.txtLoginID.Value & "' And password = '" & Me.txtPassword.Value & "'"))) Then
    MsgBox "Incorrect LoginID or Password"
    Else
    userlevel = DLookup("UserSecurity", "tblUser", "UserLogin = '" & Me.txtLoginID.Value & "'")
    DoCmd.Close
    If userlevel = 1 Then
    'MsgBox "LoginID and Password correct"
    DoCmd.OpenForm "P1 Vlan Database Form", acNormal
    DoCmd.OpenForm "P2 Vlan Database Form", acNormal
    DoCmd.OpenForm "P3 Vlan Database Form", acNormal
    DoCmd.OpenForm "BTI Vlans Form", acNormal
    Else
    DoCmd.OpenForm "P1 Vlan Database Form", DataMode:=acFormReadOnly
    DoCmd.OpenForm "P2 Vlan Database Form", DataMode:=acFormReadOnly
    DoCmd.OpenForm "P3 Vlan Database Form", DataMode:=acFormReadOnly
    DoCmd.OpenForm "BTI Vlans Form", DataMode:=acFormReadOnly

    End If
    End If
    End If
    End Sub

  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,518
    One option is to toggle the AllowEdits property of the form in the focus events of the combo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jlyalls is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    19
    I am not sure how to do this. What would you recommend? Leaving the code I have and trying to mess with the allow edits? I tried to setup the Go To VLAN combo box with an On Got Focus macro of RunMenuCommand EditListItems but was unsuccessful.

    Thanks,

    Josh

  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,518
    I don't use macros, but I suspect it would be SetProperty, setting the AllowEdits property of the form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    jlyalls is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    19
    Does anyone else have any ideas about what I could use in Microsoft visual? I have this Navigation field that when a user types in a number it takes you to that record page. My issues is that I have security set for different users and when the user is set to 2 I have them as "Ready Only". I want to be able to open it for them with readyonly but allow them to type into the combo box "Go to Record". Right now as the code sits it will not allow edits. Could I put some code behind the readonly statement that says something like allowedits for the combobox Go to Record?

    Again here is the code

    If (IsNull(DLookup("[UserLogin]", "tblUser", "[Userlogin] ='" & Me.txtLoginID.Value & "' And password = '" & Me.txtPassword.Value & "'"))) Then
    MsgBox "Incorrect LoginID or Password"
    Else
    userlevel = DLookup("UserSecurity", "tblUser", "UserLogin = '" & Me.txtLoginID.Value & "'")
    DoCmd.Close
    If userlevel = 1 Then
    'MsgBox "LoginID and Password correct"
    DoCmd.OpenForm "P1 Vlan Database Form", acNormal
    DoCmd.OpenForm "P2 Vlan Database Form", acNormal
    DoCmd.OpenForm "P3 Vlan Database Form", acNormal
    DoCmd.OpenForm "BTI Vlans Form", acNormal
    Else
    DoCmd.OpenForm "P1 Vlan Database Form", DataMode = acFormReadOnly <---- But Allow edits for combo box cboGotoRecord
    DoCmd.OpenForm "P2 Vlan Database Form", DataMode:=acFormReadOnly <---- But Allow edits for combo box cboGotoRecord
    DoCmd.OpenForm "P3 Vlan Database Form", DataMode:=acFormReadOnly <---- But Allow edits for combo box cboGotoRecord
    DoCmd.OpenForm "BTI Vlans Form", DataMode:=acFormReadOnly <---- But Allow edits for combo box cboGotoRecord

  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,518
    Like I said, in the focus events of the combo:

    Me.AllowEdits = True
    Me.AllowEdits = False
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Here's a small tutorial I've given people for doing this kind of thing.

    Remove whatever you've done to make the Form Read-Only, 'mark' the one Control you want to be able to use, your Combobox, so that Access can recognize it, then loop thru all Controls and Lock those not 'marked.'

    In Design View, select the Control you want to be functioning and go to Properties-Other and in the Tag Property box enter DoNotLock, just like that, no quotes.

    Then place this code in the code window:
    Code:
     Private Sub Form_Load()
     
    Dim ctrl As Control
    
     For Each ctrl In Me.Controls
       If (TypeOf ctrl Is TextBox) Or (TypeOf ctrl Is CheckBox) Or (TypeOf ctrl Is ComboBox) Then
        If ctrl.Tag <> "DoNotLock" Then
         ctrl.Locked = True
        End If
       End If
      Next
    
    End Sub


    You should be set!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    jlyalls is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    19
    Is there anyway I can send either of you the file to look at? I feel I am missing something as far as what I am trying to do.

    Thank you,

    Josh

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You should be able to attach it here, after compact/repair and zipping.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    jlyalls is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    19
    Do I need to start a new post? I am having a difficulty doing this.

  11. #11
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Do I need to start a new post?
    No, but the zipped file size should be less than 2 mb


    Click on the "Go Advanced" button below the Quick Reply.
    Scroll down to the button "Manage Attachments". Click and follow the prompts.

  12. #12
    jlyalls is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    19

    Access VLAN file

    ALL_VLAN_Databases.zip

    Let me know if this works.

  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,518
    I don't see where you tried anything, my suggestion in post 6 in particular.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    jlyalls is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    19
    I apologize, I did try them, I just wanted to send you guys the clean slate that I used. When I tried what you suggested Pbaldy I could not get it to work correctly. I am sure I did something wrong but I did try what you suggested to the best of my abilities. Sorry for the confusion.

    Josh

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

Similar Threads

  1. Replies: 24
    Last Post: 03-04-2013, 06:15 PM
  2. Open report from data entry form
    By pbuecken in forum Forms
    Replies: 5
    Last Post: 01-14-2012, 12:07 PM
  3. Replies: 9
    Last Post: 04-04-2011, 11:13 AM
  4. No entry on open form
    By grant.smalley in forum Forms
    Replies: 4
    Last Post: 01-07-2010, 01:23 AM
  5. Replies: 4
    Last Post: 03-24-2009, 09:07 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