Hi,
I am trying to find an item in a table and report back if it is found. I am workin gin Access 2003, and if possable I want to stick to using ADO. The code I have below I thought would do it, but it does not work. With this set up I get an error saying that I am either at the BOF or EOF or the current record has been deleted. If someone can tell me what I am doing wrong I would appreciate it.
Thank you
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL1 As String
strSQL1 = "Select * from Orders Where order_num = '" & Text1 & "'"
Set cn = CurrentProject.Connection
Set rs = New ADODB.Recordset
rs.Open strSQL1, cn
If rs!order_num = Null Then
Text3 = "the item is not in the table"
Else
Text3 = "the item is not in the table"
End If
End Sub
I am trying to find an item in a table and report back if it is found. I am workin gin Access 2003, and if possable I want to stick to using ADO. The code I have below I thought would do it, but it does not work. With this set up I get an error saying that I am either at the BOF or EOF or the current record has been deleted. If someone can tell me what I am doing wrong I would appreciate it.
Thank you
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL1 As String
strSQL1 = "Select * from Orders Where order_num = '" & Text1 & "'"
Set cn = CurrentProject.Connection
Set rs = New ADODB.Recordset
rs.Open strSQL1, cn
If rs!order_num = Null Then
Text3 = "the item is not in the table"
Else
Text3 = "the item is not in the table"
End If
End Sub