Getting the value from a query back into a subroutine

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
 
C

CatScratch

Fixed it my self

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

CatScratch
 
Top