• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 999
  • Last Modified:

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?
0
awarraic
Asked:
awarraic
  • 4
  • 3
1 Solution
 
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now