I'm new to VBA.
I'm trying to figure it out how to make Access, upon click of a button, open a load-from-file window to upload 8 files.
I have some particular thing about it.
I need it to rename to the autonumber of the form, auto upload the 8 and export to a predetermined location.
The code I have so far is.
Someone has some ideas how to do it?
I'm trying to figure it out how to make Access, upon click of a button, open a load-from-file window to upload 8 files.
I have some particular thing about it.
I need it to rename to the autonumber of the form, auto upload the 8 and export to a predetermined location.
The code I have so far is.
Code:
'FILE DIALOG OPENS UPLOAD PANEL
Private Sub Comando715_Click()
Call Selectfile
End Sub
'FUNÇÃO CAIXA DE SELEÇÃO
Public Function Selectfile() As String
Dim Fd As FileDialog
Dim Filtro As FileDialogFilters
Set Fd = Application.FileDialog(msoFileDialogOpen)
With Fd
'FILTRO DE IMAGENS
Set Filtro = .Filters
With Filtro
.Clear
.Add "Imagens", "*.jpeg;*.jpg"
End With
'NÃO PERMITIR MULTI-SELEÇÃO
.AllowMultiSelect = True
'DEFINE O NOME DA CAIXA DE SELEÇÃO
.Title = " Por favor introduza as fotos da peça"
If .Show = True Then
'CODIGO DE COLOCAÇÃO DE ANEXO EM FORMULÁRIO
Selectfile = .SelectedItems(1)
Me.Anexo412.DefaultPicture = Selectfile
Else
MsgBox "Clicou no botão cancelar ao escolher imagem."
Exit Function
End If
Set Fd = Nothing
End With
End Function
Comment