Prev: Query to Pull Most Recent Call with a Callback Date Scheduled
Next: Search criteria between - and
From: Dee on 19 Apr 2010 14:25 Thank you, this works perfectly. (I am using a single form). "KenSheridan via AccessMonster.com" wrote: > If you are using a form in single form view then you also need to set the > Visible property of the control in the form's Current event procedure. You > can use the same code, but you can in fact simplify it to a single line as > you are not assigning a value to the EmployeeStatus field in this case: > > Me.EmpEndDate.Visible = (Nz(Me.EmployeeStatus,"") = "Inactive") > > If you are using a form in continuous form's view, however, each instance of > the EmpEndDate field will be shown or hidden, not just the current one; you > are really seeing the same control multiple times. In this situation you can > hide the value in the contol by means of conditional formatting by setting > the ForeColor property of the control to the same colour as its BackColor > property. In the conditional formatting dialogue for the EmpEndDate control > do this on the basis of the expression: > > Nz([EmployeeStatus],"") = "Active" > > If you do this I'd suggest that you also enable/disable the control in both > the EmployeeStatus control's AfterUpdate event procedure and the form's > Current event procedure. Otherwise a user would still be able to enter data > in the EmpEndDate control when its value is 'hidden', but would not see what > they are entering. The code for this would be: > > Me.EmpEndDate.Enabled = (Nz(Me.EmployeeStatus,"") = "Inactive") > > Note the use of the Nz function in the above expressions. This is because a > Null is neither equal nor unequal to anything, not even to Null. By using > the Nz function to return a zero-length string however, comparison of the > string values becomes possible. > > Ken Sheridan > Stafford, England > > Dee wrote: > >I am trying to make a field visible (EmpEndDate) if the EmployeeStatus field > >is Inactive. I would like it to be invisible if the field is active or null. > > I have read other posts but still need some assistance. I have the below > >code so far but it is not working quite right. When I change one record, > >they all change so I dont know if I need to incude the ID (AutoNumber) in the > >code? > > > >Private Sub EmployeeStatus_AfterUpdate() > >If Me.EmployeeStatus = "Inactive" Then > >Me.EmpEndDate.Visible = True > >Else > >Me.EmployeeStatus = "Active" > >Me.EmpEndDate.Visible = False > >End If > >End Sub > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access/201004/1 > > . >
First
|
Prev
|
Pages: 1 2 Prev: Query to Pull Most Recent Call with a Callback Date Scheduled Next: Search criteria between - and |