How to knowing when a query is done 
Author Message
 How to knowing when a query is done

How do you tell when a query operation (using JET) is done?  If it was an
asynchronous DAO operation you can check the StillExecuting property.  But I
can not find a way to do this.

All I am trying to do is use COUNT(*) to return the number of rows that are
in a query.  If I step through the code it works fine but if I run it the
value is not return.  Here is the code:

Private Sub cmdCount_Click()
Dim nCount As Long

With Me
    .RecordSource = "ABJRAR"
    .RecordsetType = 2
    .Filter = "rday >= #01/01/89# and rday <= #01/31/89#"
    .FilterOn = True
End With
txtMonth.ControlSource = "= Count(*)"
nCount = txtMonth

txtMonth.SetFocus
txtMonth.ControlSource = ""
txtMonth.Text = nCount

End Sub

If someone could tell me how to save the result of executing a count query
into a variable then I would not have to do any of the gyrations above.
Specifically if I issue the count query:
    SELECT COUNT(*) FROM ABJRAR
How do I save the result into a variable?



Sun, 13 Jan 2002 03:00:00 GMT  
 How to knowing when a query is done

Quote:

> How do you tell when a query operation (using JET) is done?  If it was an
> asynchronous DAO operation you can check the StillExecuting property.  But I
> can not find a way to do this.

> All I am trying to do is use COUNT(*) to return the number of rows that are
> in a query.  If I step through the code it works fine but if I run it the
> value is not return.  Here is the code:

> <code snip>
> If someone could tell me how to save the result of executing a count query
> into a variable then I would not have to do any of the gyrations above.
> Specifically if I issue the count query:
>     SELECT COUNT(*) FROM ABJRAR
> How do I save the result into a variable?

Try using the DCount function rather than opening the recordset.

--
HTH
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|  gHaD (Aaron Robinson) |The Never-Ending Commute|
| MJM-PC Solutions, Inc. |Web & Database Developer|
|       Chicago, IL      |   Will work for Dew?!  |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Sun, 13 Jan 2002 03:00:00 GMT  
 How to knowing when a query is done
That's great, it solves the problem, thank you.  Do you, or anybody else,
have answers on how to do the what I was trying?  Someday, I will probably
want to do these things.

Quote:


>> How do you tell when a query operation (using JET) is done?  If it was an
>> asynchronous DAO operation you can check the StillExecuting property.
But I
>> can not find a way to do this.

>> All I am trying to do is use COUNT(*) to return the number of rows that
are
>> in a query.  If I step through the code it works fine but if I run it the
>> value is not return.  Here is the code:

>> <code snip>
>> If someone could tell me how to save the result of executing a count
query
>> into a variable then I would not have to do any of the gyrations above.
>> Specifically if I issue the count query:
>>     SELECT COUNT(*) FROM ABJRAR
>> How do I save the result into a variable?

>Try using the DCount function rather than opening the recordset.

>--
>HTH
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>|  gHaD (Aaron Robinson) |The Never-Ending Commute|
>| MJM-PC Solutions, Inc. |Web & Database Developer|
>|       Chicago, IL      |   Will work for Dew?!  |
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Mon, 14 Jan 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Please tell me what I am doing wrong - DAO parameter Append Query :(

2. I know this can be done ! ( But I am not smart enough to know how :) )

3. Recordset: What am I doing wrong?

4. What am I doing wrong??

5. What am I doing wrong?

6. Help with syntax. What am I doing wrong

7. What am I doing wrong?

8. What am I doing wrong?

9. What am I doing wrong?

10. Can this be done or am I dreaming?

11. Am I doing the OpenRecordset command correctly?

12. What am I doing wrong? -MultiSelect List box

 

 
Powered by phpBB® Forum Software