Access 2010 How to change default starting point in a drop down box

Hi. In Access 2010 I have some reports that are sorted by month. I would like to be able to change the starting point each month when I click the drop down box so I don't have to scroll from 2002 to the current year to find the month. It's not a huge deal, but it would be nice if I didn't have to do that extra step. Where would I go to adjust this setting. Also, it is important that the previous months be viewable so I could scroll back if I needed to do so. I hope this makes sense. Thank you.
reportsdropdown.png
ryanrh24Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
what is the rowsource of the combobox? post it here

you can use this codes in the enter event of the combo box

me.combo0.dropdown
me.combo0.value=dateserial(year(date()),month(date())+1,0)


off course that will vary depending on the rowsource of your combo box
0
ryanrh24Author Commented:
I have attached a screen shot of the Row Source I believe.
RowSource.png
0
Rey Obrero (Capricorn1)Commented:
need to see sample values.. better if you upload a copy of the db eith the form and relevant table and queries.
0
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

ryanrh24Author Commented:
I'm not sure what you mean. Upload the entire database file?
0
Rey Obrero (Capricorn1)Commented:
yes, just remove sensitive info
0
ryanrh24Author Commented:
Okay this should be it. Under the reports section is where I access it the most.
DB1.mdb
0
Rey Obrero (Capricorn1)Commented:
ok. what is the name of the form and the name of the combo box?
0
ryanrh24Author Commented:
Form - frmFuelInvoiceReport
combo box - rdatepull

Also, this combo box is used in multiple forms for pulling all the different report types.
0
Rey Obrero (Capricorn1)Commented:
place this codes in the enter event of the combo box


Private Sub rdatepull_Enter()
me.rdatepull.dropdown
Dim iYear As Integer, iMonth As Integer
iYear = Year(Date): iMonth = Month(Date)
Me.rdatepull.Value = DLookup("iddate", "QRY_datepull", "mmonth=" & iMonth & " and myear=" & iYear)
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ryanrh24Author Commented:
That is great! Will I need to change this each month or is it set to automatically do that?
0
Rey Obrero (Capricorn1)Commented:
<Will I need to change this each month> NO
 or is it set to automatically do that? YES
0
ryanrh24Author Commented:
How would you change the code so it would show one month previous to the current month every time?
0
Rey Obrero (Capricorn1)Commented:
change this

 iMonth = Month(Date)

to

 iMonth = Month(Date) -1
0
ryanrh24Author Commented:
Thank you! I am receiving a new error. I have attached screen shots.
The main issue is whenever I use the Enter key to select the date from the rdatepull (Month) drop down box, it won't process the same way as when I click the date with my mouse, thus making the report unable to load. Is there a piece of code I can place in there to correct this?
dateError1.png
dateDebugError1a.png
dateError2.png
dateDebugError2a.png
0
ryanrh24Author Commented:
I still haven't been able to figure this out. I cannot make tabbing over and hitting enter do the same thing as clicking on the date with the mouse. It may have something to do with this macro I attached. Any help would be much appreciated! The first attachment is after the rdatepull code was added. The second is before, when the enter button worked.
rdatepulladded.png
macrodatepull1.png
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.