Hi Jeff
Thank you for your post several days ago.
I have 2 subforms on a main form. I am counting the number of records on
each of these, so there are just 2 count boxes.
The database design is:
Vehicles Table (VRM as PK with 5 other fields)
Drivers Table (DriverID as PK with 9 other fields)
VehiclesDrivers (VRM and DriverID as PKs) = junction table
Previous stops table (Stop ID as PK, linked to Vehicles by VRM)
I am having problems in the relationship window with the relationship line
disappearing between the previous stops and vehicles tables. Is this a bug?
Could this be affecting the count delay?
Here is the query used for the 1st continuous subform (to show drivers
related to the vehicle selected in the main form, linked by VRM):
SELECT Drivers.Surname, Drivers.[First Names], Drivers.DOB, Drivers.Sex,
fncDriverWarnings(VehiclesDrivers.DriverID) AS Warnings, Drivers.DriverID,
VehiclesDrivers.VRM, VehiclesDrivers.DriverID FROM Vehicles INNER JOIN
(Drivers INNER JOIN VehiclesDrivers ON
Drivers.DriverID=VehiclesDrivers.DriverID) ON
Vehicles.VRM=VehiclesDrivers.VRM;
The 2nd continuous subform on the form uses the following query:
SELECT [Ticket Ref].TicketID, [Ticket Ref].[Ticket Reference No], [Ticket
Ref].VRM FROM [Ticket Ref];
The database is virtually empty and I'm still experimenting with it before
filling it with data so lots of records are not causing the delay.
If you've got any thoughts on this I'd love to hear them.
Jeff Boyce said:
Rich
"all of ?what? count boxes..."? You mentioned one -- you have many?
You have multiple subforms, not just one? Your original post mentioned "on
a form". Your second post mention "a subform".
Have you tried creating a query to see how long it takes (see my previous
post)?
Could you describe the main form/subform design you are using?
Regards
Jeff Boyce
<Access MVP>
Rich1234 said:
Jeff
I have just put a textbox on a subform and typed =Count("*") as the control
source. (I read about how to do this in this forum.) I have not
incorporated this within any SQL code.
It successfully counts the number of records in the subform, just with a
delay. The rest of the form and subforms appear instantaneously, just with
this time lag on all of the count textboxes. I'm using textboxes to count
records shown on several different subforms within the main form. All of the
count boxes show their respective count around one second after everything
else on the forms and subforms is populated.
The queries themselves run instantaneously. I'm a newbie and don't know how
to use the DCount function. Do I have to put a count in the SQL in order to
avoid this delay?
Thanks Jeff
Rich
Jeff Boyce said:
Rich
I'm still not seeing the SQL statement you are using to Count(*). Are you
using the DCount() function?
What happens if you use something like (your syntax may vary):
SELECT Count(*) FROM [Vehicle Details Query];
And how long does [Vehicle Details Query] take to run?
Regards
Jeff Boyce
<Access MVP>
Hi Jeff
Thanks for your message. I have been away for a while... hence my lack of
reply.
I am using Count(*) to count records returned from the following query:
SELECT [Vehicle Details Query].VRM, [Vehicle Details Query].Date, [Vehicle
Details Query].Time, [Vehicle Details Query].Driver, [Vehicle Details
Query].Location, [Vehicle Details Query].OIC, [Vehicle Details
Query].[Action
Taken/ comments] FROM [Vehicle Details Query];
This is on a subform which displays information related to the main form
using VRM as the related field.
Can you help? Do you need more information?
Thanks
Richard
:
?"count the number of records on a form"?
Access doesn't store records in forms ... data is stored in records,
displayed in forms (and reports, and queries).
Count(*) will count all the records in a dataset -- what dataset are you
using?
More info, please...
Jeff Boyce
<Access MVP>
Hi
I am using =Count("*") to sount the number of records on a form..
however,
there is a time lag of around 1 second before this number is
calaculated
on
the form. The PC I'm using is not new by any means, but this delay is
far
longer than any other other delay I have experienced for anything in
Access.
The database has hardly any data in it and is not particularly
comlpex.
Any
advice?
Thank you in advance
Rich