Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dlgCommon.ShowOpen Question....

Status
Not open for further replies.

brainmetz

Technical User
Feb 12, 2003
34
US
I have this in a module called import:

Public Function Import_Data_Enter()
Dim strFileName As String ' you could make this global if need be
dlgCommon.ShowOpen
strFileName = dlgCommon.FileName
If strFileName = "" Then End
DoCmd.TransferText acImportDelim, "import", "Activity_File", strFileName
End Function

I then created a macro that would run the module but it fails out everytime at the dlgCommon.ShowOpen line.

The error says:
object required...

The code works fine if i put a button on a form and just run the code from the button, but i need it to be a macro for other reasons.

Thanks,

Shane
 
Your example doesn't have a form object. If you put this in a module, and it isn't code-behind-the-form then this function has no way of knowing where the dlgCommon is located, assuming it is the name of a common dialog ActiveX control.

Quick Example:
--------------------------------------------
Dim frm As Form
Set frm = Forms("AnyOpenFormname")
With frm
.dlgCommon.ShowOpen
strFileName = .dlgCommon.FileName
End With
-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top