j'ai une certaine expérience en programmation mais découvre aujourd'hui Access.
J'en ai, en effet besoin, ne disposant pas d'autre chose de connu par moi(Oracle, mysql...)
J'ai fait un peu de vba sous excel et, pour gagner du temps, j'utilisais la fonction "Macro/nouvelle macro" qui permettait d'enregistrer toutes les actions faites sur le classeur.
Je ne vois pas un tel menu sous access (2003). Existe-t-il ?
Si oui, où ?
Le premier besoin que j'ai est l'import d'un fichier texte.
Je pensais donc lancer l'enregistrement, faire un import manuel et partir de cette base pour coder.
Tant pis, je vais retrousser mes manches.
Option Compare Database
Sub Main()
'Declare a variable as a FileDialog object.
Dim fd As FileDialog
'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'Declare a variable to contain the path
'of each selected item. Even though the path is aString,
'the variable must be a Variant because For Each...Next
'routines only work with Variants and Objects.
Dim vrtSelectedItem As Variant
'Use a With...End With block to reference the FileDialog object.
With fd
.Filters.Add "text Files", "*.TXT"
.Filters.Add "All Files", "*.*"
'Use the Show method to display the File Picker dialog box and return the user's action.
'The user pressed the button.
If .Show = -1 Then
'Step through each string in the FileDialogSelectedItems collection.
For Each vrtSelectedItem In .SelectedItems
'vrtSelectedItem is a string that contains the path of each selected item.
'You can use any file I/O functions that you want to work with this path.
'This example displays the path in a message box.
MsgBox "The path is: " & vrtSelectedItem
Next vrtSelectedItem
'The user pressed Cancel.
Else
End If
End With
'Set the object variable to nothing.
Set fd = Nothing
End Sub
__________________________
PS: VBA pour EXCEL est maintenant dans Bureautique
merci de poser vos questions VBA à cet endroit
salutations
RGI
Un MERCI en retour c'est sympa
et ne pas oublier le tag :après résolution.