Neuigkeiten:

Ist euer Problem gelöst, dann bitte den Knopf "Thema gelöst" drücken!

Mobiles Hauptmenü

Datei auswählen und abspeichern

Begonnen von aknirsch, November 25, 2013, 18:37:59

⏪ vorheriges - nächstes ⏩

aknirsch

Hallo Zusammen,

ich habe folgendes Formular (Bildanhang) und den Code dazu. Ich möchte nun den ausgewählen Dateinamen in einer Tabelle speichern. Bekomme jeodch das Feld nicht gebunden??

Gruss

Option Compare Database
Option Explicit
     
Private Sub cmdFileDialog_Click()

' This requires a reference to the Microsoft Office 11.0 Object Library.

   Dim fDialog As Office.FileDialog
   Dim varFile As Variant
   Dim SourceFile, DestinationFile, newFile As String
   Dim fso
   Set fso = CreateObject("Scripting.FileSystemObject")

   ' Clear the list box contents.
   ' Me.FileList.RowSource = ""

   ' Set up the File dialog box.
   Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
   With fDialog
      ' Allow the user to make multiple selections in the dialog box.
      .AllowMultiSelect = False
           
      ' Set the title of the dialog box.
      .Title = "Datei auswählen"

      ' Clear out the current filters, and then add your own.
      .Filters.Clear
      .Filters.Add "Access Databases", "*.MDB"
      .Filters.Add "Access Projects", "*.ADP"
      .Filters.Add "All Files", "*.*"

      ' Show the dialog box. If the .Show method returns True, the
      ' user picked at least one file. If the .Show method returns
      ' False, the user clicked Cancel.
      If .Show = True Then
         ' Loop through each file that is selected and then add it to the list box.
         For Each varFile In .SelectedItems
            'Me.FileList.AddItem varFile
            Me.File = varFile
            SourceFile = varFile
            ' FileCopy(SourceFile, "c:\tmp\")
           
                       
         Next
      Else
         MsgBox "You clicked Cancel in the file dialog box."
      End If
   End With
End Sub

DF6GL

Hallo,

Wo ist denn das Textfeld "File" ?

Diesem wird doch schon der ausgewählte Dateiname zugewiesen ( Me.File = varFile)  und kann auch an ein Tabellenfeld gebunden werden, d.h. im Steuerelementinhalt dieses Textfeldes steht der Tabellenfeldname.


Viele Grüße vom Bodensee
Franz, DF6GL

Hilfestellung:  http://www.access-o-mania.de/forum/index.php?topic=6969.msg118738#msg118738

Links und Tipps:
1.   http://v.hdm-stuttgart.de/~riekert/lehre/db-kelz/
1a. http://www.tinohempel.de/info/info/datenbank/normalisierung.htm
1b. https://support.office.com/de-de/article/Grundlagen-des-Datenbankentwurfs-eb2159cf-1e30-401a-8084-bd4f9c9ca1f5#bmterms
2.   http://www.donkarl.com
3.   https://web.archive.org/web/20201201233522/http://www.dbwiki.net/
4.   http://www.access-tutorial.de/
5.   http://www.tty1.net/smart-questions_de.htm
6.   http://access.joposol.com/accept

Last but not least:   < F1 > für Hilfe
;) Learning by doing not by spoon-feed ;)

Tipp: Find and Replace for Access

aknirsch

Hast Recht! Die Tabelle wird nun gefüllt...

Kannst Du mir noch einen Tipp geben?

Ich möchte nun die Datei von varfile nach c:\tmp kopieren

varfile Wert ist:

c:\dokumente\test.doc

Ergebnis soll sein:

c:\tmp\test.doc

DF6GL

Viele Grüße vom Bodensee
Franz, DF6GL

Hilfestellung:  http://www.access-o-mania.de/forum/index.php?topic=6969.msg118738#msg118738

Links und Tipps:
1.   http://v.hdm-stuttgart.de/~riekert/lehre/db-kelz/
1a. http://www.tinohempel.de/info/info/datenbank/normalisierung.htm
1b. https://support.office.com/de-de/article/Grundlagen-des-Datenbankentwurfs-eb2159cf-1e30-401a-8084-bd4f9c9ca1f5#bmterms
2.   http://www.donkarl.com
3.   https://web.archive.org/web/20201201233522/http://www.dbwiki.net/
4.   http://www.access-tutorial.de/
5.   http://www.tty1.net/smart-questions_de.htm
6.   http://access.joposol.com/accept

Last but not least:   < F1 > für Hilfe
;) Learning by doing not by spoon-feed ;)

Tipp: Find and Replace for Access