Weird Access posting problem - any clues?

Weird Access posting problem - any clues?

Post by Mark Edwar » Sun, 21 Aug 2005 06:11:01

I am seeing a weird posting problem. I'd be interested in seeing some
opinions on what causes it, and why this seems to fix it.

Basically, I am updating fields in the Sessions table. Basically, I
open the dataset, put it into insert mode, call a subroutine to fill
the persistent fields, then attempt to post the records.

Without the sleep statement, I get random failures saying:

[Microsoft][ODBC Microsoft Access Driver] The changes you requested to
the table were not successful because they would create duplicate
values in the index, primary key, or relationship. Change the data in
the field or fields that contain duplicate data, remove the index, or
redefine the index to permit duplicate entries and try again.

With the sleep statement (or any delay, like a ShowMessage command), I
don't have any failures, and everything posts just fine. Any clues?

Mark Edwards

// Open and set into Insert Mode

// Build/Initialize Session Record

sleep(1000); // weird - this seems to stop posting errors
on E: Exception do
ShowMessage('SESSIONS ERROR: [' + E.Message + ']');

The FillSessions subroutine looks something like this:
// Clear Fields

// Build Record
DM1.dsSessionsSysMID := vSysMID;
DM1.dsSessionsSessionID := vSessID;
DM1.dsSessionsOpenDT.AsDateTime := (Now);
DM1.dsSessionsStatus.Value := 'Private';
DM1.dsSessionsDescript.Value := 'Private Network Session';

DM1.dsSessionsNetMID.AsGUID := vNetMID;
DM1.dsSessionsLMeth.Value := 'Network Controlled';
DM1.dsSessionsLTypeEq.Value := DM1.dsSessionsLMeth.Value;
DM1.dsSessionsEquipMID := vEquipMID;
DM1.dsSessionsRemarks.Value := 'Automatic: System Generated
DM1.dsSessionsCTRL.AsString := '[F3]';


Weird Access posting problem - any clues?

Post by Django Dun » Tue, 23 Aug 2005 14:56:13

Hi Mark,

What is the primary key of your table? I see you have a field
dsSeesionOpenDT that you are populating with the results of the Now
function. If your program is running on anything more powerful than a 286
you'll probably get at least 10 records posting per second - hopefully many
more than that. If that's the issue that's why your sleep command is
allowing the function to work.

You might try using an AutoInc field within your primary key or at least
supply an integer field that you populate yourself with an incrementing
number. That will guarantee the uniqueness of each record without much