Solved

Search for files and save path name to MS-Access database table

Posted on 2014-11-22
2
1,212 Views
Last Modified: 2014-11-22
I have a client who is scanning employee vaccination records.  The client wants to store the location of the scanned form to  an immunization record.  How can I code it so when they click a button, a pop-up screen is opened to allow the user to browse for the image/document and save the path to the vaccination record?

Thanks

glen
0
Comment
Question by:GPSPOW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40459783
try this codes

Private Sub cmdAttachFile_Click()
Dim rsFile As DAO.Recordset
Dim strFilePath As String, strFilename As String
strFilePath = fSelectFile()
If strFilePath & "" <> "" Then
strFilename = Mid(strFilePath, InStrRev(strFilePath, "\") + 1)
    With CurrentDb.OpenRecordset("tblFileAttachments")
        .AddNew
        !RecordID = Me.txtMainID
        !FilePath = strFilePath
        !FileName = strFilename
        .Update
    End With
End If
End Sub

Function fSelectFile()
Dim fd As Object
Set fd = Application.FileDialog(3)
With fd
    .InitialFileName = CurrentProject.Path & "\"
    .AllowMultiSelect = False
    .ButtonName = "Select"
    .InitialView = 2
    .Title = "Select File"

    'display file dialog box
    If .Show Then
          fSelectFile = .SelectedItems(1)
    Else
        Exit Function
    End If

End With
End Function

Open in new window

0
 

Author Closing Comment

by:GPSPOW
ID: 40459850
Thank you

It worked perfectly.  I will just need to tweak the destination a little.

Glen
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question