Hello all,
I have a lot of issue with Null Values. Here is the code
The issue is when strSite is empty, it gives me Error 94 Invalid use of Null but that particular field is not required to have data which is why I put that the if IsNull() but it is not working. What am doing wrong here?
I have a lot of issue with Null Values. Here is the code
Code:
Private Sub cboRestaurant_AfterUpdate()
Dim strSQL As String
strSQL = SelectFromQryCateringsWhere & "WHERE RestaurantName='" & Me.cboRestaurant.Column(0) & "'"
Me.txtContactName.Value = CurrentDb.OpenRecordset(strSQL).Fields(4).Value
Me.txtTn1.Value = CurrentDb.OpenRecordset(strSQL).Fields(5).Value
Me.txtTn2.Value = CurrentDb.OpenRecordset(strSQL).Fields(6).Value
Dim strEmail As String
strEmail = CurrentDb.OpenRecordset(strSQL).Fields(7).Value
If Not IsNull(strEmail) Then
Me.cmdSendEmail.Visible = True
End If
Dim strSite As String
strSite = CurrentDb.OpenRecordset(strSQL).Fields(8).Value
If IsNull(strSite) Then
MsgBox "No Website is available"
Else
Me.cmdGotoSite.Visible = True
End If
' If Not IsNull(strSite) Then
' Me.cmdGotoSite.Visible = True
' ElseIf IsNull(strSite) Then
' MsgBox "No Website is available"
' End If
Dim strMenu As String
strMenu = CurrentDb.OpenRecordset(strSQL).Fields(11).Value
If Not IsNull(strMenu) Then
Me.Command123.Visible = True
End If
Me.txtAddress = CurrentDb.OpenRecordset(strSQL).Fields(9).Value
Me.txtComments = CurrentDb.OpenRecordset(strSQL).Fields(12).Value
End Sub
The issue is when strSite is empty, it gives me Error 94 Invalid use of Null but that particular field is not required to have data which is why I put that the if IsNull() but it is not working. What am doing wrong here?
