General information
Category:
Database DAO/RDO/ODBC/ADO
Title:
Null values in field of recordset
Dim cnSMDR1 As Connection
Dim rsCodes As Recordset
Private Sub Form_Load()
Dim NewItem As ListItem
Set cnSMDR1 = New Connection
cnSMDR1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= C:\Tracit\SMDR1.mdb"
Set rsCodes = New ADODB.Recordset
rsCodes.CursorLocation = adUseClient
rsCodes.Open "Codes", cnSMDR1, adOpenStatic, adLockOptimistic
listNxx.ListItems.Clear
txtNpa = ""
End Sub
Private Sub Search_Click()
rsCodes.Filter = "NPA =" & (txtNpa.Text)
Do While Not rsCodes.EOF
Set NewItem = listNxx.ListItems.Add(, "A" & rsCodes("NXX"), rsCodes("NXX"))
NewItem.SubItems(1) = rsCodes("RC")
NewItem.SubItems(2) = rsCodes("State")
rsCodes.MoveNext
Loop
End Sub
The above code for a listbox occasionally runs across a null value in the rsCodes(RC) field. How would you suggest I skip any records containing null values in this field?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only