Hello
I have a bit of a problem. I have a table with three fields: referraldate (date formate), dischargeddate (date format) and discharged (checkbox). I am trying to write some code in the OnChange event of the dischargeddate. I want to get it so that if a discharge date is present the discharged checkbox is ticked, and if no discharge date is present, there is no tick.
I have got this so far:
Private Sub dischargeddate_Change()
If dischargeddate = "" Then
Me.discharged = 0
Else
Me.discharged = 1
End If
End Sub
when a discharge date is added, the checkbox is ticked, however, when I remove a date, the checkbox doesn't untick. I realise that when you delete a date this is different that having a null value for that field, hence I tried "".
Please can anyone point out what I am doing wrong?
many thanks
Bruce
I have a bit of a problem. I have a table with three fields: referraldate (date formate), dischargeddate (date format) and discharged (checkbox). I am trying to write some code in the OnChange event of the dischargeddate. I want to get it so that if a discharge date is present the discharged checkbox is ticked, and if no discharge date is present, there is no tick.
I have got this so far:
Private Sub dischargeddate_Change()
If dischargeddate = "" Then
Me.discharged = 0
Else
Me.discharged = 1
End If
End Sub
when a discharge date is added, the checkbox is ticked, however, when I remove a date, the checkbox doesn't untick. I realise that when you delete a date this is different that having a null value for that field, hence I tried "".
Please can anyone point out what I am doing wrong?
many thanks
Bruce