-
Hello Gurus,
I'm trying to test for a null or no data in a field from
an MS SQL table.
e.g I have 3 fields (Emp_Id,Emp_Name,Emp_Dob)
I need to check if the Emp_Dob (Date field) has been entered.
I thought just doing something like this would be enough:
Code:
cn.Connect = "uid=sa;pwd=;server=" & txtsvr & ";driver={SQL Server};database=" & txtdb & ";"
cn.CursorDriver = rdUseIfNeeded
cn.EstablishConnection rdDriverNoPrompt
cn.GetData <- Executes the SQL statement
Set RS = cnclearjob.LastQueryResults
Do Until RS.EOF
If RS("Emp_Dob") = Null Then
Check1.Value = 1
MsgBox ("DOB Empty!")
End If
RS.Movenext
Loop
Unfortunately, VB doesnt recoginise that the empty value in the field, so ignores the 'IF' statement, even if I change the statement to (IF RS("Emp_Dob")= "" then ...... that doesnt work either!
Anyone shed some light on this!!!??
Cheers
Craig.
-
Try
Code:
If IsNull(RS!Emp_Dob)
-
Hey, Thanks a lot.... that did the trick!!
Thanks Again.