Results 1 to 8 of 8
  1. #1
    Rizkidwip is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    12

    Question Between Month Criteria Query

    Hi..
    I have 3 fields of query [id], [date], and MonthOfDate:month([date]). My Date's record contain complete array of month (so it is month 1 - 12). I try to filter MonthOfDate by criteria like:
    >3 it work
    >=3 and <=12 it work
    but it didn't work perfect when i try to insert those value from a text box control form by this code
    <=forms![form1].[txt_end]
    if i input 12 on [txt_end] then run query, it display records from month=10 until month = 12

    ot if with this codes:


    >=forms![form1].[txt_start] and <=forms![form1].[txt_end]
    while i insert 1 for my [txt_start] and 12 for my[txt_end], the records display from month=1 until month=9

    how to solve that?
    thanks in advance

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    It looks like it is doing the text comparision not numbers.

    Try CInt(Textbox),

    <=CInt(forms![form1].[txt_end])

  3. #3
    Rizkidwip is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    12
    I insert cint() but still the same,it's like my access think that month 10-12 is smaller than other. I try add another textbox and try to calculate txt_end - txt_start on it. It's normal as it should,how then?

  4. #4
    Rizkidwip is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    12
    I just attached my sample db hopefully anyone can help easily
    thanks
    Attached Files Attached Files

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Can you post a copy in A2003 mdb format
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    Rizkidwip is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    12
    Sure Bob Flitz, there it's
    Attached Files Attached Files

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    I've had a play with the db you posted. Try this:
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    Rizkidwip is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    12
    Big thanks Bob Flitz, I'd just missed that step LOL-to use Field1 as my bound (1) rather than field month (2) so Novice I am

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

Similar Threads

  1. Replies: 4
    Last Post: 05-26-2013, 03:28 PM
  2. criteria for month question
    By jinz in forum Access
    Replies: 1
    Last Post: 12-05-2012, 11:06 AM
  3. Parameter with Month & Year Criteria
    By Huddle in forum Access
    Replies: 3
    Last Post: 10-24-2012, 01:20 PM
  4. Replies: 5
    Last Post: 08-02-2012, 09:44 AM
  5. Replies: 1
    Last Post: 07-13-2011, 11:00 AM

Tags for this Thread

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