Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Query Problems

Status
Not open for further replies.

EddyLLC

Technical User
Mar 15, 2005
304
US
When I run the following code I am getting an error message when I try to edit the record. The reason is the line "If Not rsCont.NoMatch" is coming up False telling me there is a matching record with the prm yet there is not. When I run the query separately putting in the same parameter as the code no records appear in the query. Am I not testing the query correctly? How can I bypass the code if in fact the record is empty?

Dim rsCont As Recordset
Dim intRecordCount As Integer
Set qdf = db.QueryDefs("qryCont")
Set prm = qdf.Parameters(0)
'Set parameter value
prm = File
'Execute QueryDef to produce a recordset
Set rsCont = qdf.OpenRecordset
intRecordCount = 1

If Not rsCont.NoMatch Then
Do
rsCF.MoveFirst
Do Until rsCF.EOF
rsCF.Edit
'Add data

rsCF.Update
rsCF.MoveNext
Loop
intRecordCount = intRecordCount + 1
rsCont.MoveNext
Loop While Not rsCont.EOF
End If


 
Replace this:
If Not rsCont.NoMatch Then
with this:
If Not (rsCont.BOF Or rsCont.EOF) Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Works great! Thanks for the insight.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top