Re: ADO - Strange Behaviour

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dirk Goldgar (dg_at_NOdataSPAMgnostics.com)
Date: 06/28/04


Date: Mon, 28 Jun 2004 01:18:05 -0400


"Ben Johnson" <anonymous@discussions.microsoft.com> wrote in message
news:222c701c45cc3$277c4450$a501280a@phx.gbl
> 1. I have a many-to-many relationship between two tables
> that is working via a third, linking, table.
> 2. My main data entry form is based on a query as there
> are numerous tables that data is drawn from to populate the
> form.
> 3. To associate an entity (Inspector) with each job
> record, a sub-form is used, based on a query that relates
> the current job record to the linking table mentioned in
> Point 1.
>
> The linking table holds three fields:
> - InspectorID, Category, ReportID
>
> The query that populates the sub-form in Point 3 uses the
> ReportID, which is contained in the main data entry form,
> as the Master and Child field. So far, all of this works fine.
>
> PROBLEM: When I need to add/change/delete an Inspector
> associated with a job the linking table is doing strange
> things. At the moment it's set up as follows:
> - the AfterUpdate event on the sub-form causes code to run
> that uses ADO to open a recordset (very similar to the
> query that the sub-form is based on) and alter the current
> record based on the current contents of the ComboBox
> control that triggered the event.
> - adding a new record works as expected, and changing an
> existing record works as expected
> - deleting a record will cause the current record to be
> deleted (which I want it to do), showing #Deleted# in each
> field of the record - BUT depending on what you do next,
> part of the record, the InspectorID and ReportID, will
> reappear in the table!!!
>
> I've tried everything I can think of but cannot fix this.
> Sometimes even when you move off the record, another one of
> these phantom records is created in the linking table.
>
> Is the problem because the control is based on a query
> already, and the ADO recordset manipulation is causing this
> weird behaviour??
>
> I know the code does what I intended it to do because I've
> put msgBoxes in between all of the steps in the code to
> report the current state of each variable as the code
> executes. The problem seems to occur after the Recordset
> object has been closed and control of the ComboBox has been
> handed back to the sub-form. That seems to be when these
> incomplete entries are appearing in the linking table.
>
> All help most appreciated!
>
> Many thanks in advance,
> Ben Johnson
> Private email:
> b<x-remove-this-x>johnson[at]netspace dot net dot au

I don't think there's enough information in your post to identify the
cause of the problem. Could you post the relevant fields from each of
the three tables, the recordsources of the form and subform, and all
code relevant to the question? I agree that it probably has something
to do with the way you're updating a table independently of the form
that is based on it, but I'd need more detailed information to see the
exact problem.

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)


Relevant Pages

  • ADO - Strange Behaviour
    ... that is working via a third, linking, table. ... My main data entry form is based on a query as there ... The query that populates the sub-form in Point 3 uses the ... ReportID, which is contained in the main data entry form, ...
    (microsoft.public.access.modulesdaovba)
  • Keeping Records in Linking Table Accurate (Long Post)
    ... The data entry form is ... is facilitated by a linking table. ... in the linking table are InspectorID, Category, ReportID. ... and it is allowed that one inspector ...
    (microsoft.public.access.queries)
  • Re: On Current event propertys impact upon reports currency
    ... The follow up date should be calculated via a query. ... > my a2k report uses as its source data a table with a field we'll call ... > 'FollowUp' which is a date field. ... > generated) via the OnCurrent event property of the data entry form via the ...
    (microsoft.public.access.reports)
  • Re: Displaying calculations on a form..
    ... open a new query, go to SQL View, and paste in the following SQL statement. ... use is the same table your data entry form is bound to. ... ORDER BY pTime DESC]. ...
    (microsoft.public.access.forms)
  • Re: database redesign
    ... > data entry form look as close to old as possible. ... > with cut positions and a query based on new table,pattern ... > Table is set up to store which pattern cuts are made to ... > postname: post1 ...
    (microsoft.public.access.gettingstarted)