If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Delete Field Data if Another Field Has Data
Hi,
I wonder if someone may be able to help me please. I have a subform called sfrmJobs which contains amongst others two fields, one called 'Predicted Date', the other ,'Actual Date'. What I would like to be happen is, if a date is keyed into the 'Actual Date' box, any date keyed into the 'Predicted Date' text box is deleted and then locks the 'Predicted Date' field for that record, but, to be honest I haven't got a clue where to start, or indeed whether it's possible. Could someone possibly help me put with this problem please? Many thanks Chris -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201001/1 |
#2
|
|||
|
|||
Delete Field Data if Another Field Has Data
You could use code like this for the Actual Date control's AfterUpdate
event: Private Sub Actual_Date_AfterUpdate() Dim blnLock As Boolean blnLock = (Me.[After Update].Value & "" "") If blnLock = True Then Me.[Predicted Date].Value = Null Me.[Predicted Date].Locked = blnLock Me.[Predicted Date].Enabled = Not blnLock End Sub You also will need to use this code for the form's Current event: Private Sub Form_Current() blnLock = (Me.[After Update].Value & "" "") Me.[Predicted Date].Locked = blnLock Me.[Predicted Date].Enabled = Not blnLock End Sub -- Ken Snell http://www.accessmvp.com/KDSnell/ "hobbit2612 via AccessMonster.com" u27332@uwe wrote in message news:a1e97c66fc598@uwe... Hi, I wonder if someone may be able to help me please. I have a subform called sfrmJobs which contains amongst others two fields, one called 'Predicted Date', the other ,'Actual Date'. What I would like to be happen is, if a date is keyed into the 'Actual Date' box, any date keyed into the 'Predicted Date' text box is deleted and then locks the 'Predicted Date' field for that record, but, to be honest I haven't got a clue where to start, or indeed whether it's possible. Could someone possibly help me put with this problem please? Many thanks Chris -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201001/1 |
#3
|
|||
|
|||
Delete Field Data if Another Field Has Data
Hi Ken,
Firstly I can't believe how quickly you came up with the coding, amazing!! I made some very minor chnages to the code and changed (Me.[After Update] to (Me.ActualDate and it works a treat. Thank you so much for your time and help it really is appreciated. Regards Chris Ken Snell wrote: You could use code like this for the Actual Date control's AfterUpdate event: Private Sub Actual_Date_AfterUpdate() Dim blnLock As Boolean blnLock = (Me.[After Update].Value & "" "") If blnLock = True Then Me.[Predicted Date].Value = Null Me.[Predicted Date].Locked = blnLock Me.[Predicted Date].Enabled = Not blnLock End Sub You also will need to use this code for the form's Current event: Private Sub Form_Current() blnLock = (Me.[After Update].Value & "" "") Me.[Predicted Date].Locked = blnLock Me.[Predicted Date].Enabled = Not blnLock End Sub Hi, [quoted text clipped - 15 lines] Chris -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201001/1 |
Thread Tools | |
Display Modes | |
|
|