Hi, I have a command button that opens a pdf file. However i will be distributing the database as a runtime package and need to account for people having different versions of adobe reader so need to search for the filepath string where Acord32.exe is found. This is the code I have but I am stuck! Ay help aprpeciated!
Private Sub Command4_Click()
Dim stAppName As String Dim stPathName As String Dim fs As Object
Set fs = Application.FileSearch With fs .LookIn = "C:Program Files" .SearchSubFolders = True .FileName = "AcroRd32.exe" .Execute ????? stAppName = .FoundFiles Set fs = Nothing End With
'specify path name for version of adobe acrord32.exe 'stAppName = "C:Program FilesAdobeReader 8.0ReaderAcroRd32.exe " stPathName = GetIniSetting("C:WINDOWSSSI_DL3_PROGRS.ini", "DIR", "REPORT_FILELOCATION") & "HOOF.pdf" Shell stAppName & stPathName, vbMaximizedFocus
I want to pass a string aPath contains path of the active workbook to access vba module or sub. Below is my excel vba code that will open access db form. How do i pass the string value to access vba.
Code: Dim aPath, aDbase, aDSource, aTable, exePath As String Dim fileParam As String aPath = ActiveWorkbook.Path aDbase = "near_14.accdb" aDSource = aPath & "" & aDbase
The code has fixed path information on a lot of places in different SQLs (DoCmd.RunSqL command). I want to replace fixed path info with variable path info. Variable path info is stored in the table.
I managed to achieve that in the following manner:
Code: Dim db As Database Dim dbName as String Set db = CurrentDb Set rs = db.OpenRecordset ("TableName", dbOpendynaset) rs.FindFirst ("ID = " & 2)
[Code] ....
where I would use as variable Function name instead of dbName.
How to make module that will enable to use Function name as variable path information for SQL queries?
With the OutputFile set to "" so the user can select the directory on where they want to store the exported template. I'm trying to figure out if I could get the file path and the file name and store it on a string so I could use it for something else.
I'm having another one of those days but I'm getting a file path and file name from a dialogbox and forgotten when the VBA property is to return the full file path and file name.
This code works fine for return the filename only:
Code:
Private Sub TEST() Dim f As Object Set f = Application.FileDialog(3) f.AllowMultiSelect = True If f.Show Then For I = 1 To f.SelectedItems.Count MsgBox Filename(f.SelectedItems(I)) Next End If End Sub
Instead of using 'Filename' what else can I use to return what I need?
Im trying to programmatically (without any user intervention) retrieve the long path name for a given file. It seems to me this should be a rather easy thing to achieve using Access VBA. Ive tried using various FileSystemObject methods with no luck. Ive Googled many variants of VBA get full path without any meaningful hits. provide the first string as a parameter to some object and have it magically return the second string.
I've recently created a new Access 2010 Database which I'm developing an interface for in VBA. I've created a new Userform in the Visual Studio (this required me to add the Userform button). I'm finding that when I insert the Multipage object which I need to use on the form I can no longer run the Userform. When I attempt to run, I get the error 'Path/File Access Error' followed by 'Run time error 75 - Could not find the specified object'.
It's definitely linked to the Multipage which I've inserted from the toolbox (standard object) as the form runs fine when it is not there and with other objects (have tested all other toolbox items). There is currently no code in written in the project, no tables or queries set up in the database therefore nothing is running when the form loads.
I've successfully used Multipages in a number of other VBA interfaces both in Access and Excel so not sure why they are causing a problem here. I've also just created a userform in exactly the same way in a new Excel sheet and it runs fine with the multipage.
I am using MS Access 2010. I have a code that I am using that loops through a folder gather all the names of the files in the folder and inserts them into a table (shown below). The table is named "tblFiles" there are two columns in the table titled file name and file path. What I want to do is to also loop through the same folder to find the file path of the files and insert them into the file path column has a hyperlink where users can just click on the hyperlink and the file opens.
Private Sub Form_Load() Dim fs, f, f1, fc, s Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("tblFiles")
I have the code below and I want it to open a file from my documents folder. The only problem is that every computers path is different to this folder. Any easy way to work around and open a file in My Documents without the full path?
I want to eliminate the part of the path in red and make it universal because computers will have a different number.
Operating System: Windows 7
Code below:
Public Function AddITARPicOffloadAnalysis() Dim xlApp As Object Set xlApp = CreateObject("Excel.Application") With xlApp Dim wb As Object Dim ws As Object Dim Lastrow As Long
I have a folder which holds 1000s of pictures organised in subfolders, for example:
D:~AI Database Print Scans2009family and D:~AI Database Print Scans2009holiday
And so forth. In total at the moment 17 main subfolders, each of which hold another 2-3 subfolders.
I am putting together a database to bring pictures together with all sorts of details. I import the picture via hyperlink and complete the various fields. All that works fine but there are a lot of pictures! And it gets confusing to see which ones have already been entered into the database and which ones haven’t.
One solution for this is to copy the pictures that have been “completed” to another folder. I have found a way to do that:
Dim fs As Object Dim oldPath As String, newPath As String oldPath = Forms!frmPrintDetails.txtPath1 newPath = "D:~AI Database Print ScansCompleted_Entries" Set fs = CreateObject("Scripting.FileSystemObject") fs.CopyFile oldPath, newPath Set fs = Nothing
Works fine, but the problem is that I loose the subfolder structure, it copies all pictures to the same main folder. I’d like to maintain the subfolder structure and add code to create the correct subfolders and next copy the picture. With the different paths I’m lost. I don’t know how to extract the correct path in code. I’d also like to either rename or remove the picture once I have completed entry of the details. The problem I have again is that I don’t know how to code for a changing path.
In the access form I want to add a button with a special functionality.
After clicking "Select file" button special window should be open (or something else). It should give user a possibility of files locating (doc, pdf, rtf, txt ...).
After selecting the file and confirm the choice in the table "File_location" in database path to the file should be saved .
I have created a form to send emails with attachments. The attachment path is specified in an unbound field which I have called [ToAttach] Rather than typing in the path, I want to use the browse function. I have inserted a browse button and can browse for the required file using following, but can't figure out how to place the file name in the unbound field as a string.
Code: Dim f As Object Set f = Application.FileDialog(3) f.AllowMultiSelect = False f.Show
I've got the forms and queries in one .accdb file and my tables in a separate .accdb file. The forms file links to the tables in the tables file. The tables file resides in a folder called simply enough C:acc_tables and thats where i browsed to (obviously) when i set up the linkage.
One of the users does not wish (for whatever goddamn reason) to create a C:acc_tables file to stick the tables file in , and wants the tables file in some other folder.. Unfortunately this user does not have the skills to delete the existing links and re-link to the tables file after putting it in the folder he wants.
Where in the file that holds the forms and and queries do i find the path setting to the tables linked file? Can it be changed without deleting links and then re-linking?
I have a button that allows a user to select a file using the windows select file dialog using the following code:
Dim fd As FileDialog Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd .Title = "Select A Text file to Import" .Filters.Add "Text File", "*.txt" .FilterIndex = 1 .AllowMultiSelect = False .InitialFileName = CurrentProject.path result = .Show If (result <> 0) Then Me!txt_path = Trim(.SelectedItems.Item(1)) End If End With
Is there a way that I can capture the path of the file they select in a separate text box?
I went to the Microsoft knowledge base (304408) and found a routine that automatically logs off users with a short warning. It works fine, but depends on the presence or absence of a small text file which is named chkfile.ozx. The file is referenced in a form timer function as follows:
Dim StrFilename as String strfilename = Dir("c:MyDirectorychkfile.ozx")
The function then tests for its presence and does its thing. You trigger the logoff by going in as sysop and changing the name of the file so it is no longer found.
The problem I have is that on the network, I use the backend file on the network and different users map different letters to it. I get around this by linking using UNC eg. \ServerNameSYSData_be.mdb.
I put the chkfile.ozx into this directory since all users presumably have access to it.
I tried changing the trigger function to
strfilename = Dir("\ServerNameSYSchkfile.ozx")
but the program doesn't recognize the presence of the file. When I map it as "F:SYSchkfile.ozx" it works, but since all users will not be mapped to "F", it really isn't a solution.
Does anyone know the proper syntax to include in the Dir method for UNC naming?
I nave a code which allows the user to upload a file to a folder "images". I want to be able to record the filename and path in a table called "attachments". But I am not sure how. Can anyone help
Private Sub Command0_Click()
Dim FD As FileDialog Dim Name As String Dim Name2 As String Dim Pathx As String Dim Path As String Pathx = Me.Application.CurrentProject.Path & "Images" Path = Me.Application.CurrentProject.Path Set FD = Application.FileDialog(msoFileDialogFilePicker) Dim vrtSelectedItem As Variant With FD .AllowMultiSelect = False 'Add a filter that includes GIF and JPEG images and make it the second item in the list. .Filters.Add "PDF", "*.pdf, 1"
'Sets the initial file filter to number 2. '.FilterIndex = 2
If .Show = -1 Then For Each vrtSelectedItem In .SelectedItems Name = Dir(vrtSelectedItem, vbSystem) Name2 = Pathx & Name If Name2 = vrtSelectedItem Then Else FileCopy vrtSelectedItem, Pathx & Name End If
i am using file browser to save a file in MS ACCESS forms. However, i want another file browser to allow the user to specify the folder he wants, then from the folder he selects, i will generate a series of codes. Any advice on How can tat be done?
I have a question: Is it possible from a form to have a field (hyperlink - I suppose) where when the user cliks it opens windows prompt (like when you do a "Open" in a word document) and the he/she can select a desired file/folder then click OK (or something) and it puts the exact path to the previously selected file into the field!
I have been trying to figure this out for ages but I cant seem to get the code right or find any info on it.
In my database i have a mail merge on a button click which creates a new merged word document. I then need a way of when the user saves the document in word, bringing back the file path and putting it in a table called tblHistory with the correct customer ID in there too.
Ii have a database running on Access 10.0, I am using the insert hyperlink dialog box (access by Ctrl K) to allow users to insert a hyperlink to a file (could be any sort of file), into a text box.
The problem I have is most of the files are held many directories above where the database is (we have a BAD directory policy, 10's of folders within folders) and it gets a little painful to get the user to go up so many levels, due to the hyperlink dialog opening in the "current folder" view, ie where the db is located.
Simple quest, or so I thought. Can I change the default directory "Current Folder" that the dialog box starts in ?
I have already tried chdir"c:" but to no avail.......not that obvious then...
I am creating a database where I want to be able to browse to a file, select it and import it into a table. I am able to do this. BUt what I want to do is create a log of these imports and haveit include the path of where the file was inported from.
The field I am having issues with is the capturing the path of the file.
Below is what I am using to browse and import a file.
Private Sub Command5_Click() Dim dlg As FileDialog Set dlg = Application.FileDialog(msoFileDialogFilePicker) With dlg .Title = "Select the Excel file to import"