"On Current" property question (1 Viewer)

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
I want to be able to edit fields on a record in a form and then when I go to the next record - to NOT be able to change the data on the previous record. Is this done in the "On Current" form property? What would I enter?

Something else to keep in mind is that I want to be able to go into this form in the future and edit a different field in the same record (because not all data is known at one time; however I don't want to be able to change the data at this form level once it's been entered).

Thank you!!
 

vbaInet

AWF VIP
Local time
Today, 19:15
Joined
Jan 22, 2010
Messages
26,374
You can set the Allow Edits property of the form to No.
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
I tried that but then it won't let me modify any of the data in the form at all.
 

vbaInet

AWF VIP
Local time
Today, 19:15
Joined
Jan 22, 2010
Messages
26,374
You have two conflicting statements:
Something else to keep in mind is that I want to be able to go into this form in the future and edit a different field in the same record (because not all data is known at one time; however I don't want to be able to change the data at this form level once it's been entered).
If you don't want previously entered records to be tampered with but still want to be able to add new records then Allow Edits is what you're after.

What exactly are you trying to do?
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
I want to be able to enter data in a field of a record only one time. And then come back to that same record and enter data in another field (without being able to modify the field I entered previously).
 

vbaInet

AWF VIP
Local time
Today, 19:15
Joined
Jan 22, 2010
Messages
26,374
So you're talking about locking/unlocking individual fields? In that case you're right about thinking it's the Current event.

For this field set the Locked property of the textbox to True in design view and in the Current event use the NewRecord property of the form to unlock it, otherwise keep it locked.
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
This part I understand: "For this field set the Locked property of the textbox to True in design view"

But how exactly do I "in the Current event use the NewRecord property of the form to unlock it, otherwise keep it locked" ?
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
I get the impression that I won't be able to edit anything?
I pulled this from your link:

Sub NewRecordMark(frm As Form) Dim intnewrec As Integer intnewrec = frm.NewRecord If intnewrec = True Then MsgBox "You're in a new record." _ & "@Do you want to add new data?" _ & "@If not, move to an existing record." End If End Sub


I submit to your expertise and will try this. It may take a bit.
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
I get this message: Run-time error '424', Object required. (And the text in red below is highlighted):

Private Sub Form_Current()
intnewrec = frm.NewRecord
If intnewrec = True Then
MsgBox "You're in a new record." _
& "@Do you want to add new data?" _
& "@If not, move to an existing record."
End If
End Sub
 

vbaInet

AWF VIP
Local time
Today, 19:15
Joined
Jan 22, 2010
Messages
26,374
Ignore the code. It just explains what the NewRecord property does. Basically:
Code:
If Me.NewRecord = True
   ...unlock the textbox...
Else
   ...lock the textbox...
End If
Which translates to, if the current record is a new record unlock the textbox, otherwise keep it locked.
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
but it's really not a "new" record is it? i want to enter additional data in an existing record . . . I will enter the code you gave me though.
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
I'm guessing I don't need these dots ...unlock the textbox...? I don't know exactly what to enter?

Private Sub Form_Current()
If Me.NewRecord = True Then
...unlock the textbox...
Else
...lock the textbox...
End If
End Sub
 

vbaInet

AWF VIP
Local time
Today, 19:15
Joined
Jan 22, 2010
Messages
26,374
I want to be able to enter data in a field of a record only one time. And then come back to that same record and enter data in another field (without being able to modify the field I entered previously).
I'm going by what you said above. The way you describe it there's only one field that you would like locked permanently after data has been entered and saved. On the other hand, you would like to come back that same record (at some point) and enter data into a totally different field. Isn't this what you're after?

Let's get the logic right first before delving into code.
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
but I don't know which field it may be - it could be field1 that gets an entry the first go round and then come back to the record to enter new data in other fields; OR it could be field2 that gets an entry the first go round and then come back to the record to enter data in other fields (and so on)
 

vbaInet

AWF VIP
Local time
Today, 19:15
Joined
Jan 22, 2010
Messages
26,374
You're not explaining this clearly. I believe what you're trying to do now is lock those fields that have already been filled in and allow editing of those that were not filled it at the time of creating the record. Is this correct?
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
Yes! This is want I want to do:

"Lock those fields that have already been filled in and allow editing of those that were not filled it at the time of creating the record."

I just won't know which fields will be edited at what time. And I truly apologize for not being clear. It is not for lack of trying.
 

vbaInet

AWF VIP
Local time
Today, 19:15
Joined
Jan 22, 2010
Messages
26,374
That's not a problem. Can I see a screenshot of your form in design view. A full view please.
 

Ms Kathy

Registered User.
Local time
Today, 14:15
Joined
May 15, 2013
Messages
190
The blue background fields are those which will get filled in (at some point) - the others are locked.

Thank you for bearing with me. I am trying.

It is almost noon time here and I am required to leave at noon. I will return to this office on Tuesday. I don't have access to this from home so I won't be back online until then.

Thanks again. I'll check back on Tuesday!
 

Attachments

  • FORM_view.jpg
    FORM_view.jpg
    100.1 KB · Views: 37

vbaInet

AWF VIP
Local time
Today, 19:15
Joined
Jan 22, 2010
Messages
26,374
From what you've just showed me, there's still something missing in this puzzle. We'll pick it up tomorrow (it's Wednesday evening here already ;))
 

Users who are viewing this thread

Top Bottom