Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    jeffhanner is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Sep 2022
    Location
    Lincolln, CA
    Posts
    40

    Form not accepting DataMode

    I have four forms which are subforms from a Navigation form. I have created TempVars!TempACDataMode which is set to "2" for a Read Only User.
    In the code below, I Browseto any of the four forms. Three of them work fine, however one, frmContactsMain, continues to allow Editing.
    I have used debug.print in a line just before the BrowseTo and the value is 2. I have compared the properties of my "failing" form with the other three forms and cannot find a difference. On all forms, the Allow Edits, was set to yes, however, when I went to set it to NO on my failing form, it didn't change.
    Is there anything anyone can think of that would prevent the DataMode (2) from taking effect for one form?



    Code:
     Select Case m_CallForm
         
            Case "frmCallLogMain"
               
                DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[CallLogID]=" & TempVars!TempCallLogID, "", TempVars!tempACDataMode
    
    
            Case "frmContactsMain"
                Debug.Print "AC Data Mode before calling frmContactsMain " & TempVars!tempACDataMode
    
                DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[ContactID]=" & TempVars!tempContactID, "", TempVars!tempACDataMode
                
      
            Case "frmFacilityOwnersMain"
             
                DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubForm", "[FNumber]= '" & TempVars!TempFNumber & "'", "", TempVars!tempACDataMode
               
            Case "frmShelterMain"
                 
                'If TempVars!tempLoginName = "Jeff Hanner" Then
                
                DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[SNumber]=" & TempVars!TempSNumber, "", TempVars!tempACDataMode
                
                Debug.Print "AC Data Mode after calling Shelter Main "; TempVars!tempACDataMode
                
                'Else
                
                'DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[SNumber]=" & TempVars!TempSNumber, "",, TempVars!TempACDataMode
                
               ' End If
                
             
         End Select

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Hate to jump to possible corruption of the 'main' form but given that code you'd think it ought to work if the first Case works. However, don't pass zero length strings for parameters you're not using. A parameter that won't accept a string ought to cause some sort of failure (and I would have thought an empty string for any string type of parameter would be an issue). If an optional inner parameter is not used, just add the comma and move on to the next parameter. I'd try that first.

    "[CallLogID]=" & TempVars!TempCallLogID, , , TempVars!tempACDataMode
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    jeffhanner is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Sep 2022
    Location
    Lincolln, CA
    Posts
    40
    So, TempVars!tempACDataMode is always either 1 or 2, never a null value.
    I can get an old main form and try it to see whether it has been corrupted.

    Thanks but I replaced the form from with an older form and it worked the same way. I probably have to go back a year to get a real old form to try.
    Last edited by jeffhanner; 10-13-2022 at 06:31 PM. Reason: Update

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    So, TempVars!tempACDataMode is always either 1 or 2, never a null value.
    If that pertains to my comment about zls ( "" ) for parameter values you're missing the point. If not, never mind.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    jeffhanner is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Sep 2022
    Location
    Lincolln, CA
    Posts
    40
    Quote Originally Posted by Micron View Post
    If that pertains to my comment about zls ( "" ) for parameter values you're missing the point. If not, never mind.
    It was, so, could you explain it a little more. I guess I didn't understand.

    Thank you.

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    syntax:
    BrowseTo (ObjectType, ObjectName, PathtoSubformControl, WhereCondition, Page, DataMode)
    BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[CallLogID]=" & TempVars!TempCallLogID, "", TempVars!tempACDataMode

    You have "" as the parameter for Page parameter (in red). IMO, never do that for missing optional parameters. You insert a comma that holds the place for it.
    BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[CallLogID]=" & TempVars!TempCallLogID, , , TempVars!tempACDataMode

    syntax is here
    https://learn.microsoft.com/en-us/of...docmd.browseto
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    jeffhanner is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Sep 2022
    Location
    Lincolln, CA
    Posts
    40
    Quote Originally Posted by Micron View Post
    syntax:
    BrowseTo (ObjectType, ObjectName, PathtoSubformControl, WhereCondition, Page, DataMode)
    BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[CallLogID]=" & TempVars!TempCallLogID, "", TempVars!tempACDataMode

    You have "" as the parameter for Page parameter (in red). IMO, never do that for missing optional parameters. You insert a comma that holds the place for it.
    BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[CallLogID]=" & TempVars!TempCallLogID, , , TempVars!tempACDataMode

    syntax is here
    https://learn.microsoft.com/en-us/of...docmd.browseto

    I thought I had replied to this, however, it seems to be missing.

    I removed the "" from the syntax and it worked the same way. I tried substituting acformreadonly for the TempVars!TempACDataMode, but no difference. When I did that with the other three forms, they did become ReadOnly. I also changed the AllowEdits property for each form to NO (With no DataMode in the BrowseTo command) and that worked for the other three but no for frmContactsMain.
    I'm now taking a deep dive into the forms properties vs. the other three and a few other swapping tehniques.

    Thanks for helping.
    Last edited by jeffhanner; 10-14-2022 at 12:51 PM. Reason: Corrections

  8. #8
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    If you remain stuck consider copying, compacting, zipping your db file and post here. See "how to attach files" in forum header menu if you need help to post a file.
    I'm out of ideas without seeing your db.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    jeffhanner is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Sep 2022
    Location
    Lincolln, CA
    Posts
    40
    Quote Originally Posted by Micron View Post
    If you remain stuck consider copying, compacting, zipping your db file and post here. See "how to attach files" in forum header menu if you need help to post a file.
    I'm out of ideas without seeing your db.
    Thank you for the offer, however the data is confidential, and I can't pass it on. I will just keep troubleshooting. Thanks again for all your help. If I find the solution, I will post it. The program works great except for that one issue.

    Jeff

  10. #10
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Understood. In case it's an option:
    https://www.accessforums.net/showthread.php?t=77482
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    jeffhanner is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Sep 2022
    Location
    Lincolln, CA
    Posts
    40
    I'm not sure why my replies keep disappearing, however, here it is again:

    I opened the backend (tables Only) and created a new module. I copied the randomizing function into the module. However, I'm not sure what to do with the Update statement. I tried the immediate window and I tried putting it in a subroutine. In both I get this error: "Expected End of Statement" with Set highlighted. I'm probably missing something.

  12. #12
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Per instructions, you have to create an update query:
    randomizing all or part of a string field by calling the function in an update query. The function call goes into the UPDATE TO row of the query design grid.
    So create new query, choose update from ribbon, add the table you want to randomize. In the Update To line of the query design grid you put
    randomizedata(tbl1.field1,3)

    but change tbl1 and field1 to your table and field names of course.

    Your posts don't seem to need moderating so not sure what's going on there. Better post then reopen thread to see if your latest is there. Perhaps you're clicking the wrong button to submit?

    HTH
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #13
    jeffhanner is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Sep 2022
    Location
    Lincolln, CA
    Posts
    40
    Thank you. I will try that.

  14. #14
    jeffhanner is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Sep 2022
    Location
    Lincolln, CA
    Posts
    40

    Resolving a DataMode Issue.

    I have attached two files, front end and backend. In order to log in you will have to Map an E: drive with a folder SCD. Place both files in that folder.

    Temporary Logins for this Fake program are: Jeffh and password 16142 which is an "Admin" password giving you edit rights.
    Micron and password 17142 which is a "ReadOnly Password

    The form that won't take the ReadOnly datamode (tempVars!tempACDatamode is frmContacts

    The main navigation form is frmSCD from which frmContacts can be called.

    Double clicking a selected contact triggers the following function which is located in MyFunctions module.

    Public Function mcrSearch(m_CallLogID, m_CallForm, m_ButtonPressed, m_FullName, m_ContactID, m_FNumber, m_SNumber, m_ReturnForm)


    Here is the section of that function where I have the problem in the BrowseTo:

    Code:
    Select Case m_CallForm
         
            Case "frmCallLogMain"
               
                DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[CallLogID]=" & TempVars!TempCallLogID, , TempVars!tempACDataMode
    
    
            Case "frmContactsMain"
            
    'Debug.Print "AC Data Mode before calling frmContactsMain " & TempVars!tempACDataMode
                
                DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[ContactID]=" & TempVars!tempContactID, , TempVars!tempACDataMode
                
      
            Case "frmFacilityOwnersMain"
             
                DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubForm", "[FNumber]= '" & TempVars!TempFNumber & "'", , TempVars!tempACDataMode
               
            Case "frmShelterMain"
                 
                'If TempVars!tempLoginName = "Jeff Hanner" Then
                
                DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[SNumber]=" & TempVars!TempSNumber, , TempVars!tempACDataMode
                
                Debug.Print "AC Data Mode after calling Shelter Main "; TempVars!tempACDataMode
                
                'Else
                
                'DoCmd.BrowseTo acForm, m_CallForm, "frmSCD.NavigationSubform", "[SNumber]=" & TempVars!TempSNumber, , TempVars!TempACDataMode
                
               ' End If
                
             
         End Select
    Note: I have replaced or removed all sensitive information. The remaining info is publicly available.

    SCD v2.21_be_Fake.zipSCD v2.21 - Fake.zip
    Last edited by jeffhanner; 10-17-2022 at 11:00 AM. Reason: Corrections

  15. #15
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    From what I've been able to find so far, the data mode properties of a form as seen in design view override the browseto acFormOpenDataMode parameter. Not sure why you've even posted this thread since you seem to have already solved it elsewhere but didn't explain how.

    https://www.accessforums.net/showthr...810#post501810
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. DoCmd.BrowseTo with variable as datamode
    By jeffhanner in forum Forms
    Replies: 2
    Last Post: 10-12-2022, 05:10 PM
  2. Replies: 3
    Last Post: 03-26-2021, 08:13 AM
  3. Replies: 9
    Last Post: 03-18-2021, 03:20 PM
  4. New Computer not accepting 5 digits
    By abie059 in forum Database Design
    Replies: 3
    Last Post: 01-10-2011, 10:02 PM
  5. DataMode
    By RHall in forum Programming
    Replies: 1
    Last Post: 01-26-2006, 10:23 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