Disallowing Edits Not Working

You could try exporting the form and reimporting it, not something I have done, and when I just tried now I get

1712864138209.png

I tried removing Fom_ in filename and the entry in the file, with not success. It ended up coming in the module classes, so an expert is going to have to help with any export/import method.
 
I have an admin form (that certain members of my team can access) that will allow edits to fix any mistakes that happen or fix missed types. I wouldn't just leave incorrect data without it being corrected.
So every single entry in every single record is checked for accuracy. And if someone enters a 5 instead of a 6 then the error is caught. Why not just let the original entry user correct their own entry mistakes as they work? They are the ones who know what the data entry should be from the start.

OK it's your application, not mine.
 
@Josef P. That seemed to do the trick! Thank you!!

If you don't mind - can you tell me why that fixed the problem incase I run into something similar in the future?
 
So why did a brand new form work as expected?
 
Spoke too soon. Now I'm getting this error. I should note that I do have all the various fields set to Required at a table level to ensure my data entry guys can't skip out on adding vital information.

Will this interfere with the .Dirty VBA?

1712871890287.png
 
Yes, I got all that with my new form, just entering the little I needed to get it saved.. You are dirtying the record with that, before being able to enter the data. :)

TBH I think that dirty is a workaround, but I would not trust what appears to be a corrupt form, so would recreate myself.
I was thinking however, I used to store CreatedBy, CreatedDate,AmendedBy,AmendedDate in some tables in one particular DB.

You could do the same, at least for dates/times and allow perhaps 1 hour from creation to amend before you lock them as you are doing now.?

Just a thought.
 
If you don't mind - can you tell me why that fixed the problem incase I run into something similar in the future?
If a data record ist edit by VBA and not saved - see edit symbol (pensil) - Form.Dirty is True and the user can edit the data in this record.
This is the behaviour of Access. You would have to ask the Access programmers why this is the case ;)
 
Last edited:
So I've been recreating the form as @Gasman suggested and testing step by step.

This code suggested by @Pat Hartman yesterday works as expected (saved records can't be accidentally edited but new records can be created)....
Code:
Private Sub Form_Current()

    If Me.NewRecord = True Then
        Me.AllowEdits = True
    Else
        Me.AllowEdits = False
    End If
 
End Sub

Unit I added the below code to Form_Current. The below code is meant to keep certain things hidden on new records until a selection is made. Is there a way to change the below so it isn't some how negating the above?

Code:
If Me.cboResult.Column(1) = "Fail" Then
        Me.txtProblem.Visible = True
    Else
        Me.txtProblem.Visible = False
        Me.txtProblem.Value = Null
    End If
    
    'Bring up the "Problem" box when an item has failed inspection
    
     If Me.cbxControlCard = -1 Then
        Me.txtControlNumber.Visible = True
    Else
        Me.txtControlNumber.Visible = False
        Me.txtControlNumber.Value = Null
    End If
    
    'Show the control number box if a new control number was made
 
Pat - Thank you! That actually made sense to me and better yet it seems to have worked!

I appreciate everyone's help and time.

Have a great day! :)
 
From this thread https://www.access-programmers.co.u...ing-a-form-as-text-and-then-importing.330853/ I have been shown how to save and import Forms as text, which I was hoping would remove any corruption?
You might want to try that sometime. Could save you a lot of time reformatting the form?

Code:
Application.SaveAsText acForm, "frmName", "C:\path\to\file.txt"

' and

Application.LoadFromText acForm, "frmName", "C:\path\to\file.txt"

Thanks to @cheekybuddha for that information.
 
Please look at the code in the thread and understand WHY i named the exported objects with specific suffixes.

I also have a database which has a lot of the code attached to forms. I didn't post the db because it is currently in flux and I haven't had a chance to fix what I broke.
Pat, what code are we talking about re export, as I cannot see any in this thread from yourself?
 

Users who are viewing this thread

Back
Top Bottom