Hi, im trying to make a record set that searched a field in a table, if the data thats enterd into a text box on a form, it returns a message saying so, ive been reading around a lot and trying different things, this is what i have so far
Dim rst As ADODB.Recordset
Dim strSQL As String
Dim strCriteria As String
Dim strValue As String
strCriteria = txtSupplierShortName.Text
strSQL = "SELECT tblSupplier.Shortname FROM tblSupplier"
Set rst = CurrentDb.OpenRecordset(strSQL)
strValue = rst
rst.MoveFirst
Do While Not strCriteria = strValue And rst.EOF
If Not strCriteria = strValue Then
rst.MoveNext
Else
End If
Loop
rst.Close
Set rst = Nothing
The thing that keeps getting the error is the strValue = rst, how do i make strValue be the current record the record set is on?
Is there a better way of doing this, or is my code not correct please let me know.
Thanks, Elliot.
Dim rst As ADODB.Recordset
Dim strSQL As String
Dim strCriteria As String
Dim strValue As String
strCriteria = txtSupplierShortName.Text
strSQL = "SELECT tblSupplier.Shortname FROM tblSupplier"
Set rst = CurrentDb.OpenRecordset(strSQL)
strValue = rst
rst.MoveFirst
Do While Not strCriteria = strValue And rst.EOF
If Not strCriteria = strValue Then
rst.MoveNext
Else
End If
Loop
rst.Close
Set rst = Nothing
The thing that keeps getting the error is the strValue = rst, how do i make strValue be the current record the record set is on?
Is there a better way of doing this, or is my code not correct please let me know.
Thanks, Elliot.