after update issue (1 Viewer)

bigmac

Registered User.
Local time
Yesterday, 23:03
Joined
Oct 5, 2008
Messages
295
can you help please ,
I have a subform with a field [test] this is a date field using the date picker , on the after update control I have the code , me.test.enabled = false .
(I am trying to stop it being updated twice ) , but when I run this it disables all [test] fields , how can I stop this please:confused:
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:03
Joined
Oct 29, 2018
Messages
21,358
Hi. Sounds like you are using a continuous form and [test] is an unbound control. Is this correct? If not, maybe you can post a screenshot of the form to help us picture what you're working with.
 

bigmac

Registered User.
Local time
Yesterday, 23:03
Joined
Oct 5, 2008
Messages
295
here we go
 

Attachments

  • test date.JPG
    test date.JPG
    65.5 KB · Views: 30

bigmac

Registered User.
Local time
Yesterday, 23:03
Joined
Oct 5, 2008
Messages
295
the field is called test date , sorry
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:03
Joined
Oct 29, 2018
Messages
21,358
Okay. Thanks. Just as I thought, it's a continuous form. As such, you won't be able to disable only one or several rows. It's either alll or none because there's really only one control on the form. I think maybe the best approach is to use the control's BeforeUpdate event to cancel any updates if the field already has a date in it.
 

bigmac

Registered User.
Local time
Yesterday, 23:03
Joined
Oct 5, 2008
Messages
295
how would I set the before update to cancel any update ?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:03
Joined
Oct 29, 2018
Messages
21,358
You could try something like:
Code:
 Private Sub TestDate_BeforeUpdate(Cancel As Integer)
    If Me.TestDate<>Me.TestDate.OldValue Then
        Cancel = True
    End If
 End Sub
 
Last edited:

Micron

AWF VIP
Local time
Today, 02:03
Joined
Oct 20, 2018
Messages
3,476
IIRC, you can also disable via Conditional Formatting but you haven't specified under what condition(s) the combo should be disabled.


edit - and yes, I did mean on a continuous form
 

Users who are viewing this thread

Top Bottom