thebatfink
Registered User.
- Local time
- Today, 00:00
- Joined
- Oct 2, 2008
- Messages
- 33
Hi,
So I have been using this code for ages, and it always used to work. I now just noticed it no longer does. Its possible I have changed some setting which has affected it's behaviour but I don't know what I have done.
Basically on a report I have a field that has the potential to be Null value. I used to test this condition using the Report_Open event and if it was Null I displayed a text box. This was using the following code:
It now seems to see everything as Null = False?!?! I have tested by setting the field in a record to Null using:
UPDATE [mytable] SET [myfield] = Null;
to ensure the field really does have a null value but it still seems to think that field is Not Null when I open the report. I know the code is firing because I have put in msgboxes to test.
For information, the report is opened from a form using a command box and the following code
I was wondering if for some reason it is seeing the field as zero length instead of Null, so I added this code into my Report_Open sub..
I also tried using If Len(Me.ManSig & "") = 0 Then.. but in each of cases, whenever I try to test the value for anything other than IsNull, I get an error
I really need to get this working again as it is critical to the functionality of the database. Any ideas would be greatly appreciated. Thank you.
So I have been using this code for ages, and it always used to work. I now just noticed it no longer does. Its possible I have changed some setting which has affected it's behaviour but I don't know what I have done.
Basically on a report I have a field that has the potential to be Null value. I used to test this condition using the Report_Open event and if it was Null I displayed a text box. This was using the following code:
Code:
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Err
DoCmd.SetWarnings False
If IsNull(Me.ManSig) Then
Me.Label174.Visible = True
Me.Label209.Visible = True
Else
Me.Label174.Visible = False
Me.Label209.Visible = False
End If
DoCmd.SetWarnings True
Exit Sub
Err:
DoCmd.SetWarnings True
MsgBox Err.DESCRIPTION
End Sub
It now seems to see everything as Null = False?!?! I have tested by setting the field in a record to Null using:
UPDATE [mytable] SET [myfield] = Null;
to ensure the field really does have a null value but it still seems to think that field is Not Null when I open the report. I know the code is firing because I have put in msgboxes to test.
For information, the report is opened from a form using a command box and the following code
Code:
DoCmd.OpenReport stDocName, acPreview, "", "[partno] = """ + Me.partno + """", acWindowNormal
I was wondering if for some reason it is seeing the field as zero length instead of Null, so I added this code into my Report_Open sub..
Code:
If Me.ManSig = "" Then
msgbox "I'm empty"
End if
I also tried using If Len(Me.ManSig & "") = 0 Then.. but in each of cases, whenever I try to test the value for anything other than IsNull, I get an error
Run-time error '2427':
you entered an expression that has no value
I really need to get this working again as it is critical to the functionality of the database. Any ideas would be greatly appreciated. Thank you.