A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Delete Field Data if Another Field Has Data



 
 
Thread Tools Display Modes
  #1  
Old January 10th, 2010, 05:51 PM posted to microsoft.public.access.forms
hobbit2612 via AccessMonster.com
external usenet poster
 
Posts: 107
Default 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  
Old January 10th, 2010, 06:21 PM posted to microsoft.public.access.forms
Ken Snell
external usenet poster
 
Posts: 177
Default 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  
Old January 10th, 2010, 06:47 PM posted to microsoft.public.access.forms
hobbit2612 via AccessMonster.com
external usenet poster
 
Posts: 107
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.