Getting the value from a query back into a subroutine

  • Thread starter Thread starter CatScratch
  • Start date Start date
C

CatScratch

I'm trying to get the value of a count field in a query and use that to
error trap in a form button OnClick property. I keep getting ..not
found in collection... error on the rsErr!qCount no matter how I try
and reference to it.

???
CatScratch


Private Sub cmdChange_Click()
Dim db As dao.Database
Dim rsErr As dao.QueryDef
Dim meCount As Long

''run check for errors -- if any, cancel process
Set db = CurrentDb()
Set rsErr = db.QueryDefs("qryRoomChangeAssignID")

rsErr("[Forms!subfrmMain_Assignments_RoomChange!txtAssignID]") =
Forms![subfrmMain_Assignments_RoomChange]![txtAssignID]

meCount = rsErr!qCount

With rsErr
If meCount > 0 Then
MsgBox "STOP"
Exit Sub
End If
End With
 
Fixed it my self

Used a Dlookup to get the value of the count in the query

CatScratch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top