- Thanks for commin back june. Well actually All the codes behind the forms are there. the recordset quaries and tables are also there. But one form was missing that was supposed to open with in a code. Could be because the module I was using was to stop the execution of the runnin code in the main form that opens an attachment file in windows media player. the execution is Paused till the player loads fully so it can take screen shot of the vedio and save as its cover. the form that was not exported is supposed to open at the end after the execution. after the plater loads. Its name is screen shot. A one inch form with one button to take the shot. So I imported the module and it did not work. the stop execution line is yellow. so I unmarked and it warned that tha form is not there so I imported it it. over all it seems ok. May be there is some error with the codes execution part that's why the module and the form that's opening after the execution was skiped from the export. But I compiled befor export and no error was there. here is the code behind that form please see if it looks okay see the part Public Sub ExecCmd(cmdline As String). so Is it this code or the filepath naming. that skiped this module and the form?
Because in the Exporting code
the folders are shown as different. But I gave the same path for both lines. Did I do right?
DoCmd.TransferDatabase acExport, "Microsoft Access", "F:\PRISM\PRISM Support Programs\Development\dbExport_" & Format(Date, "yyyy-mm-
C:\Users\Shiham\Documents\AccessProjects\dbExport *-----------------------------
- dd") & ".accdb", acForm, strName, strName
- ElseIf lngType = -32764 Then
- DoCmd.TransferDatabase acExport, "Microsoft Access", "F:\MyDatabases\dbExport_" & Form
- C:\Users\Shiham\Documents\AccessProjects\dbExport *--------------------------------------
After exporting the module it showed error on the execcmd line yellow.
- Here is the code in my main form that refer to the module and form that are suppose to be related objects Thank you june
Code:
Private Sub AddFile_Click()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True 'Adjust the File Picker to allow multiple files to be selected
.Title = "Locate a file to attach"
.ButtonName = "Choose"
.Filters.Clear
.Filters.Add "All Files", "*.*"
.InitialFileName = "C:\"
.InitialView = msoFileDialogViewThumbnail
If .Show = 0 Then
Exit Sub
End If
'We will look for multiple files selected by the user
Dim varFile As Variant
'Dim varFile As Variant
Dim rst As DAO.Recordset
Const strTable = "Table1"
Const strField = "Files"
Set rst = CurrentDb.OpenRecordset(strTable)
For Each varFile In .SelectedItems
'You can view the debug results in the immediate window (Keyboard shortcut Ctrl+G)
Debug.Print varFile 'You will have to nest your code block(s) here (before NEXT) to attach each file
'-----------------------------------------------------------------------
rst.AddNew
'rst!Last = Me.Id '
AddAttachment rst, strField, varFile
rst!FPathName = varFile
'Me.FPathName
rst.Update
rst.MoveLast
'----------------------------------------------------------------------------
Next
rst.MoveLast
'Now we can clean up the DAO object
rst.close
Set rst = Nothing
End With
'======================
DoCmd.Requery "FilePhotoSearcgFr"
DoCmd.Requery "tbl1Files11Data"
Me.Requery
DoCmd.GoToRecord , , acLast
'------------------------------------------
Dim strFilePath
With Me.RecordsetClone
.Bookmark = Me.Bookmark
strFilePath = "C:\Temp\" & Me.tbxFileName
If Dir(strFilePath) <> "" Then VBA.Kill strFilePath
![Table1.Files.FileData].SaveToFile strFilePath
ExecCmd "VBA.Shell" ' the module
VBA.Shell "Explorer.exe " & Chr(34) & strFilePath & Chr(34), vbNormalFocus
'================================================
'MsgBox "Process Finished"
End With
'MsgBox "Process Finished"
'==================================
DoCmd.OpenForm "TakeScreenshot", acNormal 'The form