Results 1 to 7 of 7
  1. #1
    Tuckejam is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    168

    CBO Default value Current Month

    Ok I have tbl_transactions which has transaction data, each with a transaction date



    then I have qry_MonthExpReport

    the qry uses functions to extract (in separate columns) the year of the transaction and the month of the transaction

    and then i have frm_MonthExpReport that has combo box with a dropdown of the year and the month to pull the data from that year and month

    The drop down cbo uses the month names typed into its row source property for its values (maybe there is a different better way to do that?)

    anyway I would like the form to open with the current month a year selected, I know I can select a default value of today's date but how do i do that for the month??

    (bonus question, is it possible to load images that are less gigantic?)


    Thanks for the help

    Click image for larger version. 

Name:	Capture.PNG 
Views:	22 
Size:	39.5 KB 
ID:	42428
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	21 
Size:	24.8 KB 
ID:	42429

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    instead of a VALUE LIST, use a table, with numeric values
    1,January
    2, Feb..

    the value can be 1 and the combo display January
    default of cboBox = month(date)

    column widths: 0;2
    hide the numeric, show the text

  3. #3
    Tuckejam is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    168
    Ranman256

    If i set it up that way, how does it get me closer to setting the default value as the current month??

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    ...anyway I would like the form to open with the current month a year selected...
    Why not just use:
    DoCmd.GoToRecord , , acLast

    in the forms Open event.

    (bonus question, is it possible to load images that are less gigantic?)
    I have no idea, but remember, some of us are OLD with failing eyesight, amongst other things
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    If I understand correctly, you want the unbound controls "cboYear" and "cboMonth" to be set to the current year and current month name when the form "frm_MonthExpReport" opens.
    You can use Value Lists or you can use Functions to fill the combo boxes. To have the current year and month, you can set them in the form open event.
    See attached dB
    Attached Files Attached Files

  6. #6
    Tuckejam is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    168
    ssanfu

    Thank you that was exactly the stuff I was looking for,
    will take me a bit to get to it and take it all apart and understand it better, but thank you for the examples

  7. #7
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You are very welcome.
    Good luck with your project.

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

Similar Threads

  1. Replies: 12
    Last Post: 12-05-2018, 03:50 AM
  2. Replies: 2
    Last Post: 02-12-2015, 05:14 AM
  3. Replies: 6
    Last Post: 05-05-2014, 10:51 PM
  4. default month and year
    By beefyalby in forum Forms
    Replies: 3
    Last Post: 12-05-2010, 11:40 PM
  5. Current month in a field as default
    By leandrosarno in forum Access
    Replies: 6
    Last Post: 02-09-2010, 05:40 AM

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