Hi all, I am trying to use the following code to return a value to a query:
Function CheckQ102(ProvString As String)
Dim db As Database
Dim rst As DAO.Recordset
Dim fld As String
Set db = CurrentDb
Set rst = CurrentDb.OpenRecordset("MissingProv"
rst.MoveFirst
fld = rst.Fields("ProvCode"
.Value
Do While Not rst.EOF
If fld = ProvString Then
CheckQ102 = "N"
Else
CheckQ102 = "Y"
End If
rst.MoveNext
fld = rst.Fields("ProvCode"
.Value
Loop
End Function
I am getting an error message when I run the query saying "Run time error 3021 - No current record"
What am I doing wrong?
Nikki Wright
Database Specialist
"Everyday is a winding road, I get a little bit closer to feelin' fine"
Function CheckQ102(ProvString As String)
Dim db As Database
Dim rst As DAO.Recordset
Dim fld As String
Set db = CurrentDb
Set rst = CurrentDb.OpenRecordset("MissingProv"
rst.MoveFirst
fld = rst.Fields("ProvCode"
Do While Not rst.EOF
If fld = ProvString Then
CheckQ102 = "N"
Else
CheckQ102 = "Y"
End If
rst.MoveNext
fld = rst.Fields("ProvCode"
Loop
End Function
I am getting an error message when I run the query saying "Run time error 3021 - No current record"
What am I doing wrong?
Nikki Wright
Database Specialist
"Everyday is a winding road, I get a little bit closer to feelin' fine"