Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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. OP
    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. OP
    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
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page