Senin, 28 Agustus 2017

Re: [MS_AccessPros] Adding file locations and filenames to a continous form

 

Art-


Just before your For Each, open a recordset to add rows to your table.

Inside the For Each, instead of Debug.Print, use the .addnew and .update methods on the recordset to create new rows.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Aug 28, 2017, at 7:15 PM, Art Lorenzini dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



OK I cam up with this...

Dim fDialog As FileDialog, result As Integer
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
     
'IMPORTANT!
fDialog.AllowMultiSelect = True
 
'Optional FileDialog properties
fDialog.title = "Select a file"
fDialog.InitialFileName = "C:\"
'Optional: Add filters
fDialog.Filters.Clear
fDialog.Filters.Add "Excel files", "*.xlsx"
fDialog.Filters.Add "All files", "*.*"
 
'Show the dialog. -1 means success!
If fDialog.Show = -1 Then
  For Each it In fDialog.SelectedItems
    Debug.Print it
  Next it
End If

Which allows me to select multiple files but how do I move them to my table and subform? I know its in the FOr Each loop but not the syntax?





With Warm Regards,
 
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265  Ext. 130
Fax (605)964-1070

"Valar Dohaeris"








From: John Viescas JohnV@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: ‎Monday‎, ‎August‎ ‎28‎, ‎2017‎ ‎10‎:‎54‎:‎17‎ ‎AM
Subject: Re: [MS_AccessPros] Adding file locations and filenames to a continous form

Art-


Do you not understand the code you posted earlier in the other thread?

Dim strPath As String

    ' If you want to use the Office FileDialog object,
    ' comment out the following code and remove the
    ' comments from the block below
' ***** Begin ComDlg code
    ' Establish a new ComDlg object
    With New ComDlg
        ' Don't allow multiple files
        .AllowMultiSelect = False
        ' Set the title of the dialog
        .DialogTitle = "Locate MTT picture File"
        ' Set the default directory
        .Directory = CurrentProject.Path & "\Pictures\"
        ' .. and file extension
        .Extension = "bmp"
        ' .. but show all graphics files just in case
        .Filter = "Image Files (.bmp, .jpg, .gif, .pdf)|*.bmp;*.jpg;*.gif;*.pdf"
        ' Tell the common dialog that the file and path must exist
        .ExistFlags = FileMustExist + PathMustExist
        If .ShowOpen Then
            strPath = .FileName  ' 
<===========
        Else
            Exit Sub
        End If
    End With
' ***** End ComDlg code



John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Aug 28, 2017, at 5:05 PM, Art Lorenzini dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



But how do I pull the information from th eOpenFile dialog or whatever?


With Warm Regards,
 
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265  Ext. 130
Fax (605)964-1070

"Valar Dohaeris"








From: John Viescas JohnV@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: ‎Monday‎, ‎August‎ ‎28‎, ‎2017‎ ‎09‎:‎19‎:‎31‎ ‎AM
Subject: Re: [MS_AccessPros] Adding file locations and filenames to a continous form

Art-


If you want to save multiple files per row in tblDocumentMain, you'll need another table related on DOC_ID with one row per document.  If you want to save just one file per row, use code similar to what you did for frmMTTNoteDetails.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Aug 28, 2017, at 4:07 PM, Art Lorenzini dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Table: tblDocumentMain                                                                                                          Page: 1

  Columns

            Name                                                                 Type                               Size

            DOC_ID                                                              Long Integer                                        4

            DateEntered                                                         Date With Time                                     8
            DATEOFDOC                                                        Date With Time                                     8
            DOCENTITY                                                         Short Text                                        255
            DOCFOLDER                                                         Short Text                                        255
            DOCTYPE                                                            Short Text                                        255
            DOCSOURCE                                                        Short Text                                        255
            Importance                                                          Short Text                                        255
            DOCREF                                                              Short Text                                        255
            Notes                                                                 Long Text                                            -
            UpdateDateTime                                                    Date With Time                                     8
            DOCGROUP_ID                                                     Long Integer                                        4
            DOCTREENODE_ID                                                 Long Integer                                        4
            DOCUSER_ID                                                       Long Integer                                        4
            RESPOSNAME                                                       Short Text                                        255
OK.  Open file dialog will be accessed via a command button. The table structure is defined as follows:

The pertinent fields for this discussion are DOCFOLDER which should contain the path and filename.


With Warm Regards,
 
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265  Ext. 130
Fax (605)964-1070

"Valar Dohaeris"








From: John Viescas JohnV@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: ‎Monday‎, ‎August‎ ‎28‎, ‎2017‎ ‎08‎:‎57‎:‎48‎ ‎AM
Subject: Re: [MS_AccessPros] Adding file locations and filenames to a continous form

Art-


What is the structure of the tables involved, and where do you plan to add the files?

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Aug 28, 2017, at 3:18 PM, dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:




I have a continuous form call sfrmDocumentList which records source is a table called tblDocuments. I need to open the file dialog and be able to add multiple files into the subform and also updating the table with the locations...


THank you,


Art Lorenzini

Sioux Falls, SD














__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (9)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar