Anyone can help me to perfect these function??

sorry I'm new to ms access
anyone can help me to perfect these function??

If Format(Now(), "yy") = x Then
DoCmd.OpenForm MeRecord + x
End If

example : current year = 2018,it reads the 18,and open form MeRecord18.
example : current year = 2019,it reads the 19,and open form MeRecord19.
Poop HolyAsked:
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.

John TsioumprisSoftware & Systems EngineerCommented:
if right(year(now),2) =xx then DoCmd.OpenForm MeRecord + x

Open in new window

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
NorieAnalyst Assistant Commented:
Try this.
    DoCmd.OpenForm "MeRecord" & Format(Now(), "yy")

Open in new window

0
Dale FyeOwner, Developing Solutions LLCCommented:
Are you going to have a separate form for every year?  Seems rather labor intensive, why would you create a separate form for each year?  The only reason I could see doing that is if you had a situation like the income tax where the calculations on the form varied from year to year.

Normally, you would use the same form, but if you only wanted to view data for a particular year, you would filter the data, something like:

docmd.OpenForm "MeRecord", , , "Format([DateField], 'yy') = 18"

In this example, "DateField" would be replaced by the column name of a field which contains the dates you want to filter on.

Hope this helps
Dale
0
Gustav BrockCIOCommented:
A bit smarter method is:

Const FormPrefix As String = "MeRecord"
Dim FormID As String

' x = "19"

FormID = Format(Date, "yy")
If FormID = x Then
    DoCmd.OpenForm FormPrefix & FormID
End If

Open in new window

0
John TsioumprisSoftware & Systems EngineerCommented:
Solution Provided
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
Databases

From novice to tech pro — start learning today.