VBA coding update - change value in other field depending on value of this field (1 Viewer)

Valery

Registered User.
Local time
Today, 02:58
Joined
Jun 22, 2013
Messages
363
Hi all,

I need to add coding to an existing event procedure. It should do two things :

The event is set in the AfterUpdate of the following:
Name: txtMoveOutDate Control Source: tblOccupancy.MoveOutDate

If that field is updated, so not null anymore, event should say/do:

1) Set the MailList field to "0" (MailList is a checkbox)
Name: txtMailList, Control Source: MailList


2) IF the field :
Name: cboStatus, Control Source: Status

= "F", change it to "M"

Current event coding:

Code:
Private Sub txtMoveOutDate_AfterUpdate()
    MailList = 0
    Me.Refresh
End Sub

Thank you kindly!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:58
Joined
May 7, 2009
Messages
19,247
Code:
Private Sub txtMoveOutDate_AfterUpdate()
    MailList = 0
[COLOR=Blue]    If Trim(Me.txtMoveOutDate & "") <> "" Then
        Me.txtMailList = False
        Me.cboStatus = "M"
    End If
[/COLOR]    Me.Refresh
End Sub
 

Valery

Registered User.
Local time
Today, 02:58
Joined
Jun 22, 2013
Messages
363
Thank you Arnel!! Sorry for my ignorance but where does it say: IF field content was an "F", change to an "M". As I do have a Status "O" and that one will not change upon that txtMoveOutDate being filled...
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:58
Joined
May 7, 2009
Messages
19,247
sorry about that:
Code:
Private Sub txtMoveOutDate_AfterUpdate()
    MailList = 0
    If Trim(Me.txtMoveOutDate & "") <> "" Then
        Me.txtMailList = False
        If Me.cboStatus = "F" Then Me.cboStatus = "M"
    End If
    Me.Refresh
End Sub
 

Valery

Registered User.
Local time
Today, 02:58
Joined
Jun 22, 2013
Messages
363
Awww! THANK YOU! Any luck with that diagram yet, with the "live" parking spaces? Tough one, right?
 

Users who are viewing this thread

Top Bottom