|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Runtime error after deploymentI was wondering if anyone of you could enlighten me here. i have an application which i am trying to package here. After generating the exe file and installing it, the error occurs. I have a function which allows user to create a new database. Everytime i execute that particular function, i get an error saying that the file is not found. Can anyone tell me what is happening here? This function works fine when i debug it. Here's some code snippets of that function. Private Sub mnuNew_Click() On Error GoTo ERR_ME CommonDialog1.FileName = "" CommonDialog1.DialogTitle = "Create MAS Database" CommonDialog1.CancelError = False CommonDialog1.DefaultExt = "mas" CommonDialog1.InitDir = App.Path & CONST_DB_SAVEPATH CommonDialog1.Filter = "sch|*.sch" CommonDialog1.Action = 2 If CommonDialog1.FileName <> "" Then If Dir$(CommonDialog1.FileName) = "" Then FileCopy App.Path & "\" & GLOBAL_BLANK_MDB, CommonDialog1.FileName sDBPATH = CommonDialog1.FileName InitDatabase Else MsgBox "File already existing !!", vbInformation, "Error" End If End If Exit Sub ERR_ME: sError = Err.Description MsgBox "Error: mnuNew_Click, " & sError, vbInformation, "Error" WriteErrorLog "mnuNew_Click, " & sError End Sub
Show quote
Hide quote
"kies" <k***@discussions.microsoft.com> wrote in message Is that VBA code? Just wondering 'cuz I haven't seen "CommonDialog1.Action = news:221FF626-7E8D-40B2-9BF1-48EC33ED0C65@microsoft.com... > Hi everyone, > > I was wondering if anyone of you could enlighten me here. i have an > application which i am trying to package here. After generating the exe > file > and installing it, the error occurs. I have a function which allows user > to > create a new database. Everytime i execute that particular function, i get > an > error saying that the file is not found. Can anyone tell me what is > happening > here? This function works fine when i debug it. Here's some code snippets > of > that function. 2" for a lonnnnggg time. fwiw, CommonDialog1.ShowOpen (etc) is easier to read <g> What you'll need to do is add message boxes that show the final filenames you're dealing with. While the msgbox is on screen, after verifying that the path/name you're building is correct, open windows explorer and verify that the files are actually present. You might want to show a message box that tells you what "App.Path & CONST_DB_SAVEPATH" is too. Hoping that your constant includes a backslash and that you know that your app will never be installed in the Root folder of a hard drive (who does that anyway). Dir is just "ok" at testing for an existing file. GetAttr is the "preferred" way. Here's my generic "snip"... Private Function FileExists(FileName As String) As Boolean On Error Resume Next If Len(FileName) > 0 Then FileExists = ((GetAttr(FileName) And vbDirectory) = 0) Err.Clear End If End Function -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups.. thanks! will try out what u suggested.
Show quoteHide quote "Ken Halter" wrote: > "kies" <k***@discussions.microsoft.com> wrote in message > news:221FF626-7E8D-40B2-9BF1-48EC33ED0C65@microsoft.com... > > Hi everyone, > > > > I was wondering if anyone of you could enlighten me here. i have an > > application which i am trying to package here. After generating the exe > > file > > and installing it, the error occurs. I have a function which allows user > > to > > create a new database. Everytime i execute that particular function, i get > > an > > error saying that the file is not found. Can anyone tell me what is > > happening > > here? This function works fine when i debug it. Here's some code snippets > > of > > that function. > > Is that VBA code? Just wondering 'cuz I haven't seen "CommonDialog1.Action = > 2" for a lonnnnggg time. fwiw, CommonDialog1.ShowOpen (etc) is easier to > read <g> > > What you'll need to do is add message boxes that show the final filenames > you're dealing with. While the msgbox is on screen, after verifying that the > path/name you're building is correct, open windows explorer and verify that > the files are actually present. You might want to show a message box that > tells you what "App.Path & CONST_DB_SAVEPATH" is too. Hoping that your > constant includes a backslash and that you know that your app will never be > installed in the Root folder of a hard drive (who does that anyway). > > Dir is just "ok" at testing for an existing file. GetAttr is the "preferred" > way. Here's my generic "snip"... > > Private Function FileExists(FileName As String) As Boolean > On Error Resume Next > If Len(FileName) > 0 Then > FileExists = ((GetAttr(FileName) And vbDirectory) = 0) > Err.Clear > End If > End Function > > > > -- > Ken Halter - MS-MVP-VB - http://www.vbsight.com > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm > Please keep all discussions in the groups.. > > > |
|||||||||||||||||||||||