How to use dlgbox common dialog box in MS ACCESS VBA?

I am trying to use dlgbox (common dialog box) to let the users select a file but none of the code works in my application.
Any thoughts?
awarraicAsked:
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.

Patrick MatthewsCommented:
Seeing the code you are trying would be helpful :)
0
awarraicAuthor Commented:
I have tried tons and tons of diff code that I found over the internet.
Here's one sample code that I tried and didn't work.

Not sure if I am missing a class/object to add to make it work but Access doesn't seem to recognize cmdlgOpenFile at all.

Thanks.

-------------------------------------------------------------
Dim cmdlgOpenFile As New clsCommonDialog
Dim FileName As String    'full file name
Const clngFilterIndexAll = 5

cmdlgOpenFile.Filter = "Text Files (*.txt)|*.txt|DBF Files (DBF)|*.dbf|All Files (*.*)|*.*"
cmdlgOpenFile.FilterIndex = clngFilterIndexAll
'this is where the dialog opens
cmdlgOpenFile.ShowOpen

'returns your full file name.
FileName = cmdlgOpenFile.FileName

'hence no len, no name...
If Len(FileName) = 0 Then Exit Sub
0
Patrick MatthewsCommented:
Have you defined a class "clsCommonDIalog" in your VBA project?
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
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

awarraicAuthor Commented:
Might be silly question but... how do I do that?
0
Patrick MatthewsCommented:
You define a class by adding a class module.
0
awarraicAuthor Commented:
Ok, it's working... finally.... got all the stuff together.
This link was very helpful, just need to follow all the steps....

http://www.tek-tips.com/faqs.cfm?fid=2484
0
awarraicAuthor Commented:
thanks for the clue
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.