Results 1 to 2 of 2
  1. #1
    k0enf0rNL is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Posts
    1

    Select Month from previous selected year

    hello,



    i need 2 comboxes. 1 with year and 1 with month. the year is easy just do this in rowsource sql:
    SELECT DISTINCT (DatePart('yyyy',uitvoering.begindatumtijd)) AS Jaar
    FROM uitvoering;



    but the month is a lot harder because it needs to show the months where the year is the same as the combox with year and only show months where there is data in my table. for example i have data for only 3/12 months in a year then i need to show only those 3 months.
    i made this in vba because i think it can't be done in rowsource with sql code.
    Private Sub Tekst19_Click()
    Dim year As Integer
    year = Me.Tekst17.Value
    CurrentProject.Connection.Execute "SELECT DISTINCT (DatePart('m',uitvoering.begindatumtijd,,)) AS Maand FROM uitvoering WHERE (DatePart('YYYY', uitvoering.begindatumtijd)) = year"
    End Sub

    thanks in advance,

    K0enf0rNL


    (sorry for my bad english)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    This is already marked solved. Is it?
    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.

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

Similar Threads

  1. Previous Year Data Query Expression
    By NotReese in forum Queries
    Replies: 4
    Last Post: 11-22-2013, 04:54 PM
  2. Replies: 4
    Last Post: 05-26-2013, 03:28 PM
  3. Query Help - calculate variance previous year
    By brtucker in forum Queries
    Replies: 1
    Last Post: 01-31-2013, 05:40 PM
  4. default month and year
    By beefyalby in forum Forms
    Replies: 3
    Last Post: 12-05-2010, 11:40 PM
  5. by year by month
    By nkuebelbeck in forum Reports
    Replies: 21
    Last Post: 03-24-2010, 01:53 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