Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    29

    Unanswered: Openform and Where Clause is ignored

    When opening a form using the Openform statement and Where clause in VB the form opens apparently ignoring the Where Clause.

    Example;
    DoCmd.OpenForm "frmCustomers", , , "Customer_ID = " & 99

    The form will open and display all the records in the Customers table, not just those with Customer_ID = 99.

    I can create a new form exactly like the original form and it will work perfectly. The old form still fails.

    I really dont want to have to recreate all my forms.

    Has anyone else experienced this?

    Any ideas?

    Thanks

  2. #2
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Question Re: Openform and Where Clause is ignored

    Originally posted by jnason
    When opening a form using the Openform statement and Where clause in VB the form opens apparently ignoring the Where Clause.

    Example;
    DoCmd.OpenForm "frmCustomers", , , "Customer_ID = " & 99

    The form will open and display all the records in the Customers table, not just those with Customer_ID = 99.

    I can create a new form exactly like the original form and it will work perfectly. The old form still fails.

    I really dont want to have to recreate all my forms.

    Has anyone else experienced this?

    Any ideas?

    Thanks
    Are you copying and pasting the new form or creating it manually?

    Gregg

  3. #3
    Join Date
    Aug 2003
    Posts
    29
    I create a new blank form then copy and paste the objects ,including the module code, from the old form which is not working. I save the new form with a new name. Test it - it always works ok. Then I delete the old form and rename the new form with the name of the old form.

  4. #4
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile

    Originally posted by jnason
    I create a new blank form then copy and paste the objects ,including the module code, from the old form which is not working. I save the new form with a new name. Test it - it always works ok. Then I delete the old form and rename the new form with the name of the old form.
    Have you tried just copying and pasting in the database window?
    See if that method will still give you the same problem. If that doesn't work then you are probably changing something when you recreate the forms using your method that allows the form to function the way you expect.

    Seems like I have had similar problems in the past but cannot remember how or why.

    Not sure if this helps your situation but maybe it will spark some ideas from others here.

    Gregg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •