Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    7

    Adding Mathematical Operators to my QBF

    Okay so I have built a simple Query By Form in Access and it works great. I have also included wildcard operators. I have tested it and it works great. Some people who will be using this database would also probably like to use mathematical operators such as > and < as well as the ability to search for multiple specific values at once. Say everything equal to 1 and to 5. I will include the Query info below. You guys are amazing and I have recieved so much help. I started with zero access experience and now I've got a (almost) fully functional database that is queryable in (almost) any way people would want. You guys are amazing thank you!



    SELECT MasterTable.Account, MasterTable.Date, MasterTable.PolicyNo, MasterTable.Desk_Code, MasterTable.Amount, MasterTable.Age, MasterTable.Notes
    FROM MasterTable
    WHERE (((MasterTable.Account) Like "*" & Forms!QBF_Form!Text0 & "*" Or Forms!QBF_Form!Text0 Is Null)=True) And ((MasterTable.PolicyNo) Like "*" & Forms!QBF_Form!Text6 & "*" Or Forms!QBF_Form!Text6 Is Null) And ((MasterTable.Desk_Code) Like "*" & Forms!QBF_Form!Text8 & "*" Or Forms!QBF_Form!Text8 Is Null) And ((MasterTable.Amount) Like "*" & Forms!QBF_Form!Text10 & "*" Or Forms!QBF_Form!Text10 Is Null) And ((MasterTable.Notes) Like "*" & Forms!QBF_Form!Text12 Or Forms!QBF_Form!Text12 Is Null) And ((MasterTable.Age) Like "*" & Forms!QBF_Form!Text15 & "*" Or Forms!QBF_Form!Text15 Is Null) AND ((MasterTable.Date) Between Forms!QBF_Form!Text2 And Forms!QBF_Form!Text4 Or Forms!QBF_Form!Text2 Is Null);

  2. #2
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    Glad to hear you are progressing well. That's the good news, however looking at your syntax you need to address a more important issue. Not necessarily now but in the future.

    I noticed that when you refer to control on your form there names are all Text this or Text that. You need to give them meaningful names. For example in your table you have a field called Desk_Code, so why not call the control on the form TxtDeskCode instead of Text8. Someone else opening this form in the future will be dismayed as to how and what is happening.

    Another suggestion is to give fields names that do not contain spaces or irregular characters, a good suggestion is to use CamelCase. Using spaces means you have to enclose them with []'s which only adds to the programming.

    Also another very important point is naming conventions and reserved words. Do not have fields called Date or Month, etc. Access treats these as specific reserved words. Again this complicates the issue.

    All this said, carry on programming.

    David

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Adding 2 fields together
    By Craig Spencer in forum Access
    Replies: 2
    Last Post: 04-08-2011, 02:10 PM
  2. Adding Quantities?
    By prosbloom225 in forum Reports
    Replies: 0
    Last Post: 09-02-2009, 01:25 PM
  3. Adding a Field Name
    By jackthedog in forum Reports
    Replies: 1
    Last Post: 07-04-2009, 08:18 AM
  4. Adding pdf to a field
    By Hannu in forum Access
    Replies: 3
    Last Post: 05-27-2009, 07:08 AM
  5. Adding Two Columns
    By arthura in forum Queries
    Replies: 6
    Last Post: 05-01-2009, 08:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums