Results 1 to 12 of 12
  1. #1
    proctk is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    6

    Like function with form data

    Hi all,

    This my first post and I am a novice to Access. I started learning it over the few weeks through reading blogs and watching YouTube videos. I am stuck with a problem that I have not be able to find an answer to.



    I am trying to setup a search form that allows multiple search criteria to be entered. I found a video but it does not quite cover what I want to acomplish.

    Here is what I have like *.* &>=[Forms]![frmSBQry]![BegQuarterComb] And <=[Forms]![frmSBQry]![EndQuartComb] & *.*

    This gives me a syntax error. any ideas how to fix it... note if I remove the *.* from each end it does work. I want it to show all records if no form value was selected.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why the . character? Are these fields text type? Show sample data.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    proctk is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    6
    I typed it wrong... it should have been "*" on each end.. I am not sure how to copy and past data into the forum.

  4. #4
    proctk is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    6
    Click image for larger version. 

Name:	Screen Shot 2014-07-14 at 6.35.51 PM.png 
Views:	12 
Size:	19.4 KB 
ID:	17249
    The goal to query by the value or values entered. Not al values have to be entered. example show only November in fiscal 2012.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Can go to Advanced post editor and attach files to post or build tables in the post editor.

    All 3 fields are numeric?

    Try:

    BETWEEN Nz([Forms]![frmSBQry]![BegQuarterComb], 1) And Nz([Forms]![frmSBQry]![EndQuartComb], 4)

    BETWEEN Nz([Forms]![frmSBQry]![BegMonthComb], 1) And Nz([Forms]![frmSBQry]![EndMonthComb], 12)

    BETWEEN Nz([Forms]![frmSBQry]![BegYearComb], 1900) And Nz([Forms]![frmSBQry]![EndYearComb], 2900)

    Why is this a GROUP BY query?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    proctk is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    6
    Thank you for the reply. It not working like I want. Is the code to be entered in the same criteria row or staggered like I had it.

    Let's see if I can clarify. If user selects Begging month = 1 and ending months = 5 then show all records between those two month, but if year is selected then only show the record for the year range selected. A person could only select year values, month values or just quarter values.

    I Have GROUP by query selected because there are many records for each year, month and quarter with there own fields i the table. These values are pulled from weekly results. I don't want to see each weeks results in my query / report.

    Cheers,

  7. #7
    proctk is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    6
    I have attached a copy of my form. I want the options to work independently or in conjunction with each other based on the query.
    Attached Thumbnails Attached Thumbnails form.PNG   Screen Shot 2014-07-14 at 6.35.51 PM.png  

  8. #8
    kagoodwin13 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Feb 2012
    Posts
    181
    I think the problem is that you have conflicting pieces of information. You can't filter for quarter and then month in this example. For example, what if you choose Q2 and December? December isn't in Q2, so you'll either get a jumbled mess, or no results at all, neither of which is what you want.

    Rather than offering an option to have a beginning month/quarter/year, just offer a beginning date and end date. The query will summarize based on the date range given to it. The query then won't be confined to a month, quarter, or year. For example, you can query between 7/1/2014 and 7/31/2014 for July, or between 7/1/2014 and 9/30/2014 for Q3, or 1/1/2014 to 12/31/2014 for all of 2014.

    Also, use a text box with a date picker, not a combo box. It will make more sense for you and your users, I think.

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Good points kagoodwin. I should have seen that as well.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    proctk is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    6
    There is 3 years of weekly data. The goal of selecting ranges was to allow comparisons. So if I select Q1 to Q1 then I would be able to identify trends for the three quarters. The only time really that a person would select a combinations of options if they pick a month to month then year to year.

    If the query resulted in no results that is fine.. the person would have to try again . 95% of the time it will be using the database.

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Try my suggested criteria all on one row to invoke the AND operator.

    If still need help, provide db for analysis and testing. Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    kagoodwin13 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Feb 2012
    Posts
    181
    Quote Originally Posted by proctk View Post
    There is 3 years of weekly data. The goal of selecting ranges was to allow comparisons. So if I select Q1 to Q1 then I would be able to identify trends for the three quarters. The only time really that a person would select a combinations of options if they pick a month to month then year to year.

    If the query resulted in no results that is fine.. the person would have to try again . 95% of the time it will be using the database.
    I don't think you would be able to get that result in the current way that your data and query are set up. Can you provide an example of the data, or the database itself? Follow June7's instructions below.

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

Similar Threads

  1. Edit/Update function data type mismatch
    By gaker10 in forum Forms
    Replies: 11
    Last Post: 07-09-2014, 02:41 PM
  2. Replies: 3
    Last Post: 05-14-2014, 06:07 AM
  3. Use Function to find data from a Query
    By SaskiFX in forum Programming
    Replies: 7
    Last Post: 01-17-2014, 08:11 AM
  4. Help with IIf function in a data entry form!
    By sankalp88 in forum Forms
    Replies: 2
    Last Post: 09-01-2013, 04:07 PM
  5. Access Data (VLOOKUP function?)
    By rmoreno in forum Queries
    Replies: 13
    Last Post: 06-05-2013, 03:43 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