Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Access changing query criteria when saving a form's VBA code

Discussion in 'Information Technology' started by Michael Lysons, Jul 28, 2006.

  1. Michael Lysons

    Michael Lysons
    Expand Collapse
    Guest

    Hi

    Apologies if this has already been covered. I have tried searching the web
    and this site, but I have been unable to find any mention of this problem. I
    am using Access Version 2003 (11.6566.6568) SP2.

    As the title says, Access is changing the criteria in a couple of queries
    whenever I save a specific form's VBA code. The manner of the change to the
    query criteria is that the criteria refers to a different form than the one
    it should do. This causes the queries to fail as the newly referenced form
    doesn't contain the fields expected.

    The queries should refer to the form whose VBA code I am changing. However,
    upon saving the VBA code (and the form itself, I suppose) the queries have
    their criteria altered. An example:

    Correct criteria in a query:
    Forms!frmMainTab!txtDateTo

    After saving the VBA code changes to frmMainTab, query says:
    Forms!frmAssignCodes!txtDateTo

    The queries altered are used in frmMainTab, but at no time do I change the
    query or open the query or involve the query in any way. At all. As far as
    I know, of course.

    I can make the queries work again by editing them so they again refer to
    frmMainTab, but this is not ideal as I am sure you can imagine. I have tried
    Compact and Repair, exporting to a new database etc, but nothing has worked.

    Any ideas as to why this is happening?

    Thanks
     
  2. Loading...


  3. NetworkTrade

    NetworkTrade
    Expand Collapse
    Guest

    where is the query's criteria? Is it in the criteria field of the query
    design view matrix?
    --
    NTC


    "Michael Lysons" wrote:

    > Hi
    >
    > Apologies if this has already been covered. I have tried searching the web
    > and this site, but I have been unable to find any mention of this problem. I
    > am using Access Version 2003 (11.6566.6568) SP2.
    >
    > As the title says, Access is changing the criteria in a couple of queries
    > whenever I save a specific form's VBA code. The manner of the change to the
    > query criteria is that the criteria refers to a different form than the one
    > it should do. This causes the queries to fail as the newly referenced form
    > doesn't contain the fields expected.
    >
    > The queries should refer to the form whose VBA code I am changing. However,
    > upon saving the VBA code (and the form itself, I suppose) the queries have
    > their criteria altered. An example:
    >
    > Correct criteria in a query:
    > Forms!frmMainTab!txtDateTo
    >
    > After saving the VBA code changes to frmMainTab, query says:
    > Forms!frmAssignCodes!txtDateTo
    >
    > The queries altered are used in frmMainTab, but at no time do I change the
    > query or open the query or involve the query in any way. At all. As far as
    > I know, of course.
    >
    > I can make the queries work again by editing them so they again refer to
    > frmMainTab, but this is not ideal as I am sure you can imagine. I have tried
    > Compact and Repair, exporting to a new database etc, but nothing has worked.
    >
    > Any ideas as to why this is happening?
    >
    > Thanks
     
  4. Michael Lysons

    Michael Lysons
    Expand Collapse
    Guest

    Yes, the criteria is there.

    "NetworkTrade" wrote:

    > where is the query's criteria? Is it in the criteria field of the query
    > design view matrix?
    > --
    > NTC
    >
    >
    > "Michael Lysons" wrote:
    >
    > > Hi
    > >
    > > Apologies if this has already been covered. I have tried searching the web
    > > and this site, but I have been unable to find any mention of this problem. I
    > > am using Access Version 2003 (11.6566.6568) SP2.
    > >
    > > As the title says, Access is changing the criteria in a couple of queries
    > > whenever I save a specific form's VBA code. The manner of the change to the
    > > query criteria is that the criteria refers to a different form than the one
    > > it should do. This causes the queries to fail as the newly referenced form
    > > doesn't contain the fields expected.
    > >
    > > The queries should refer to the form whose VBA code I am changing. However,
    > > upon saving the VBA code (and the form itself, I suppose) the queries have
    > > their criteria altered. An example:
    > >
    > > Correct criteria in a query:
    > > Forms!frmMainTab!txtDateTo
    > >
    > > After saving the VBA code changes to frmMainTab, query says:
    > > Forms!frmAssignCodes!txtDateTo
    > >
    > > The queries altered are used in frmMainTab, but at no time do I change the
    > > query or open the query or involve the query in any way. At all. As far as
    > > I know, of course.
    > >
    > > I can make the queries work again by editing them so they again refer to
    > > frmMainTab, but this is not ideal as I am sure you can imagine. I have tried
    > > Compact and Repair, exporting to a new database etc, but nothing has worked.
    > >
    > > Any ideas as to why this is happening?
    > >
    > > Thanks
     

Share This Page