Sub Or Function not defined

Ashfaque

Search Beautiful Girls from your town for night
Local time
Today, 20:53
Joined
Sep 6, 2004
Messages
897
Hi,

I am simply calling my module procedure (private sub) after clicking a button like below but the subjected error appearing as 'compile error'

Private Sub CmdImportExcel_Click()
Code:
Call MyData
MsgBox "DATA IMPORTED"
End Sub

It is strange, the other code below is working with no issue at all.....

Private Sub CmdExport_Click()
Call ProcRep1
MsgBox "DATA EXPORTED SUCCESSFULLY"
End Sub

Any help shall be appreciated....
Thanks
 
What is MyData?
 
It is a sub name..

Private Sub MyData()


Dim strPathFile As String, strFile As String, strPath As String
Dim strTable As String
Dim blnHasFieldNames As Boolean
.
.
.
.
Ens dub
Upon execution of this above code, I am receiving my Excel data imported in Access tbl. But due to said error, I am executing thru opening module code itself.

But the other private sub is working good thru click on a button.
 
If MyData is in a different module then it need to be declared public, i.e.,


Public Sub MyData()


If that module is a form module then the forms has to be open and the call would be in a format like

Call Forms("TheFormName").MyData
 
Last edited:
Also, if it's in a standard module, make sure the module doesn't have the same name.
 
Thanks Sneuberg.... it is working now..
 
Thanks Pbaldy....for your concern....
 

Users who are viewing this thread

Back
Top Bottom