G
Guest
I'm having some problems with some VBA Code. I'm not very familiar with VBA,
so I'm hunting and pecking to get things to work. I have a button on a form
to check whether the values entered by the user exist in the DB or not. If
it exists, then current values from the DB will be displayed in a text box.
If it doesn't exist, I want to make a new command button visible. This is
the part that is always creating the "Invalid Use of Null" error. Any help
would be greatly appreciated.
Private Sub CheckDomain_Click()
Dim DNS As String, DI As Integer
DNS = DLookup("[TargetDNSName]", "[dbo_TargetDomain]", "[TargetDNSName]='"
& Nz(Me.NewDomainName, " ") & "'")
DI = DLookup("[DomainID]", "[dbo_TargetDomain]", "[TargetDNSName]='" &
Nz(Me.NewDomainName, 0) & "'")
If DNS = " " Then
Me.Submit.Visible = True
Else: Me.DomainIDs = DNS & " DI: " & DI
End If
End Sub
so I'm hunting and pecking to get things to work. I have a button on a form
to check whether the values entered by the user exist in the DB or not. If
it exists, then current values from the DB will be displayed in a text box.
If it doesn't exist, I want to make a new command button visible. This is
the part that is always creating the "Invalid Use of Null" error. Any help
would be greatly appreciated.
Private Sub CheckDomain_Click()
Dim DNS As String, DI As Integer
DNS = DLookup("[TargetDNSName]", "[dbo_TargetDomain]", "[TargetDNSName]='"
& Nz(Me.NewDomainName, " ") & "'")
DI = DLookup("[DomainID]", "[dbo_TargetDomain]", "[TargetDNSName]='" &
Nz(Me.NewDomainName, 0) & "'")
If DNS = " " Then
Me.Submit.Visible = True
Else: Me.DomainIDs = DNS & " DI: " & DI
End If
End Sub