Key Violations

  • Thread starter Thread starter plegouais
  • Start date Start date
P

plegouais

Hello All,

I am having some difficulty with a series of update queries I am tryin
to run. Firstly I have a series of "sites" in one table. This is the
related to a table which has a number of "scenarios" for each of th
sites (and then values which relate to each scenario at each site)
e.g.
site 1, scenario 1
site 1, scenario 2
site 2, scenario 1 etc....

I am trying to create an input form for the site data which will the
append the fixed set of scenarios to the scenarios table based on th
site id entered into the form.

The problem I am having is that the new record is not being created i
the site table before the update query is run and therefore there is n
SiteId in the site table for the appended rows to relate to.

Im using a "confirm" button on my input form (which is opened in ad
data mode) to run the queries. The idea is that the user enters th
data and then hits the confirm button. This then updates the th
related table.

At what point does the record actually get created in the table? Can
force this? Seems to me that once this is done I can run my appen
queries without getting a key violation.

Many thanks

Phi
 
Im using a "confirm" button on my input form (which is opened in add
data mode) to run the queries. The idea is that the user enters the
data and then hits the confirm button. This then updates the the
related table.

At what point does the record actually get created in the table?

When you move off the record, or close the form, or use the Record
menu option to explicitly save the record.
Can I force this?

Yes, fortunately - put a line in the code before you run the query

DoCmd.RunCommand acCmdSaveRecord
 
Back
Top