Short version - DCount super slow. Why?
Detailed version -
I have a DBase with 1200 hospital patient records and growing. I use DCount to see if a given person's medical record number is already in the dbase to avoid duplicate entries. I think I should do it this way rather than not allowing duplicates in the field's table definition because (1)Duplicates just screw things up, (2) by not permitting duplicates for the field users get an ugly error if they enter one and I am not good at errorhandling and (3)with my little code once we identify the patient is already in the dbase I open a query directly to their record so their status can be changed from discharged to active - a convenient feature. My problem is while the DCount works it is extraordinarily slow. I have it count the number of records in the main data table that have an identical Medical Record Number to the one that was just typed in (it does the event when you leave the Medical Record Number field).
Why is this so slow. Does DCount use a linear search algorithm or a type of logarithmic quick sort. Does it search every field in the table or only the one specified in the criteria of the DCount call. Should I make a query of only Medical Record Numbers and then use that for my DCount? Is it just because our little office PC that we use for the DBase is slow?
All info or ideas appreciated sincerely,
Nelson
Detailed version -
I have a DBase with 1200 hospital patient records and growing. I use DCount to see if a given person's medical record number is already in the dbase to avoid duplicate entries. I think I should do it this way rather than not allowing duplicates in the field's table definition because (1)Duplicates just screw things up, (2) by not permitting duplicates for the field users get an ugly error if they enter one and I am not good at errorhandling and (3)with my little code once we identify the patient is already in the dbase I open a query directly to their record so their status can be changed from discharged to active - a convenient feature. My problem is while the DCount works it is extraordinarily slow. I have it count the number of records in the main data table that have an identical Medical Record Number to the one that was just typed in (it does the event when you leave the Medical Record Number field).
Why is this so slow. Does DCount use a linear search algorithm or a type of logarithmic quick sort. Does it search every field in the table or only the one specified in the criteria of the DCount call. Should I make a query of only Medical Record Numbers and then use that for my DCount? Is it just because our little office PC that we use for the DBase is slow?
All info or ideas appreciated sincerely,
Nelson