MS Access - Passing a date Value Input in a Form to an MS Access Report

I have a Form in which a user enters a date value into a text box in the format of mmddyyyy

In my VBA code, I then parse the information as follows:
StartDate = Format(CDate(Left([StartDate], 2) & "/" & Mid([StartDate], 3, 2) & "/" & Right([StartDate], 4)), "MM/DD/YYYY")

Now, I have the start date in a string in the format I want. I can MsgBox the date, I can use it as a filter in a Report, BUT I CANNOT GET THIS DATE TO APPEAR IN MY ACCESS REPORT (the capitalized words describe my problem/question)

I have a control box on my Report and I assign 'Start Date' as the Control Source, but the date field displays as #Error in my report no matter what I do - HELP!
Tom_wbiAsked:
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.

Gustav BrockCIOCommented:
You can reference the textbox directly as the control source:

=CDate(Format(Forms("NameOfYourForm")!txtStartDate, "00/00/0000"))

/gustav
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
ldunscombeCommented:
In a standard module declare StartDate as a public variable then it will be available from anywhere.

Public StartDate as string

Then in the Load event of your report.

Me.YourReportControl = StartDate

Leigh
0
JVWCCommented:
When you open the report set the openargs to = Startdate.
Then on the report, your text box source =openargs.

Cheers
JC
0
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Tom_wbiAuthor Commented:
Hi All,

Thank you for your suggestions. I will be able to test these this afternoon and post the results here.

I will probably evaluate all three suggestions to determine which is most applicable to my particular circumstance.

 Again, sorry for the delay.
0
Tom_wbiAuthor Commented:
This is what I was looking for!! Sorry about the delay!!!!

Thanks!
0
Gustav BrockCIOCommented:
You are welcome!

/gustav
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.