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.
I have created a file sweeping program in Microsoft Access via VBA in a few modules. The program simply reads certain files in certain directories, and determines if, when, and where to copy those files based on certain user inputs.
One of the features I would like to add would be to upload the files that meet that criteria to a conventional FTP server requiring a username and password. However, the last few days of research all tells me that it is not possible to perform FTP functions in Microsoft Access or in VBA.
I am just wondering if that statement is really true? I figure the worse case is that windows has its own version of FTP.exe that you can execute in a DOS window ... would one be able to perhaps create a command line execution via VBA? Any simple ideas or is it not worth the trouble trying to FTP upload some files via Microsoft Access with VBA?
I'd like to find out dynamically what my file path is to the db I'm using so that if someone changes its folder, then it doesn't crash when talking with other files. How can I get the file path to a db dynamically?
I'm running a module that loops through a record set and creates a text file per record. Once the file is complete, it gets copied to a network folder. At the start of the module, I check that the connection is open (it's through a VPN).
The file copy is:
FileCopy strFileName, strCopyFile
What's annoying me is that, intermittently, I'll get a Path/File access error - yet the file has been copied. I added in a debug statement of:
We are about to do a demo of an application and we just needed a way that when we copy a db onto a CD that it looks in the ActiveFolder Path of the Access Database for an Excel File. When we specify the full length of the file in the str Argument it dinds it just fine.
How can we change str in the code to read the CurrentDB folder path plus the document named Quote_Template_File.xls so it runs like it odes in Production.
On Error GoTo EXPORT_TEST_Err Dim str As String
str = "X:TestSDS_DB" & "Quote_Template_File.xls"
If FileAlreadyOpen(str) Then MsgBox " The Short Quote is Open Please close and try again", vbOKOnly, "Error!" Exit Sub End If Dim strSQL As String Dim db As DAO.Database Dim qdf As DAO.QueryDef
Set db = CurrentDb Set qdf = db.QueryDefs("A_SUBMISSION") qdf.SQL = "SELECT * FROM A_SUBMISSION_STRING_FINAL " _ & "WHERE Submission_ID= Forms!Frm_Submissions!Text193"
Set qdf = Nothing db.Close Set db = Nothing DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 Me!Combo9.Requery Me!Combo9 = Me!Text193 DoCmd.TransferSpreadsheet acExport, 8, "A_SUBMISSION", str, True, ""
I am trying to open an Access database via an icon on the desktop that when the icon is double clicked should open the access database on a remote server through a VPN. With Windows XP Service Pack 1a loaded it is no problem but with WIndows Service Pack 2 loaded nothing happens when the icon is double clicked. Anybody got any ideas?
I have searched high and low for information on this and have tried various bits of code but am not having much luck.
Basically what i need to do is when a mail merge is created from my database (this is already working), i need to get the save path of the word document back into the Access Database to put into a table with a hyperlink field.
This way the user can access newly merged documents from the database.
Someone must know the answer, the code I am currently using is :
Dim WordObj As Word.Application Dim Link As String
Set WordObj = GetObject("", "Word.Application") If Err.Number > 0 Then Err.Clear 'word not open Else WordObj.ActiveDocument.Save Link = WordObj.ActiveWindow.Document.Name MsgBox Link End If
Please any help is appreciated as I am completely stuck!!
Is there a code I can write in access where at the click of a button, an excel file could be imported from a specified file path and appended unto an existing table in access.
e.g. I have 5 different excel files in path C:Project each representing files from different country i.e. Slovenia, Mexico, Brazil, kenya and Angola. VBA has been written in excel such that files are automatically saved in the following format "shortname of country"_"PreviousMonth"&"current year" e.g. If i'm processing in July, Slovenia's file would have been saved as SLO_June2006.
I want a code i can write in access such that when a processor chooses which country shortname he/she intends to process at the main menu in July and clicks the button "Process", access goes to the file path C:Project and picks up the file of the shortname. I also need access to be able to know that the correct file to be picked up is the one for the previous month if there are more than one file for the country in that file path.
I have a db that is going to copy a link onto the citrix desktop of specific users.
Here is the bit if code I can't get to work. I keep getting there error "file/path access error". Code: FileCopy "T:SWPFSouthwest Premium Finance Company.lnk", "L:Documents and Settings shusterDesktop"
If I use the .bat below, it works. Code: Copy "T:SWPFSouthwest Premium Finance Company.lnk" "L:Documents and Settings shusterDesktop"
I have tried using the UNC, but it makes no difference. I have full rights, plus the .bat works, so I don't think this is a network issue.
Am I missing something stupid? I don't see why this is not working.
Anybody have any other options on how to delete a dir on C: drive..?
I'm having an issue with this:
Code: If fIsFileDIR("C:DBIMAGES", vbDirectory) = True Then RmDir "C:DBIMAGES"
RUNTIME ERROR 75: "Run-time error 75: path/file access error." This error occurs when a program is installed on a network and the user does not have rights to the program directory. For the program to work properly on a network, users must be given rights by the network administrator......
All I am trying to do is import a Report from one MS Access db into another.
When I do this I get the following error: "Path/File access error :"VB4.tmp" Press okay and then I get this . . . "Name conflicts with existing module, project, or object librabry. Press okay and then I get this . . . "No Current Record"
I have converted 6 Excel spreadsheets to one CSV text document distinguished by their sheetnames. Where I am stuck is trying to import that CSV file into 6 separate tables in my Access database. Does anyone have any ideas how to do this using VBA. I am still a newbie at this, so any help would be appreciated.
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
Comments Returns a filename from a path. For example, calling this function with a value of:
Example Sub GetNameFromPath () ' ============================================== ' Example code for GetNamePart() ' ---------------------------------------------- ' Returns the file name of the specified file. ' ============================================== Dim strFullPath As String Dim strName As String
strFullPath = "C:DATAPAYROLLMYACCTS.MDB"
strName = GetNamePart(strFullPath)
MsgBox "The file name is " & strName
Function GetNamePart(strIn As String) As String ' Comments : Returns the name and extension of a fully qualified file name ' Parameters: strIn - path and name to parse ' Returns : file name + extension ' Dim intCounter As Integer Dim strTmp As String
For intCounter = Len(strIn) To 1 Step -1 If Mid(strIn, intCounter, 1) <> "" Then strTmp = Mid(strIn, intCounter, 1) & strTmp Else Exit For End If Next intCounter
Comments Returns a path part of a path/filename string. For example, calling this function with a value of:
Example Sub GetFilePath () ' ============================================== ' Example code for GetPathPart() ' ---------------------------------------------- ' Returns the path of the specified file. ' ============================================== Dim strFullPath As String Dim strPath As String
strFullPath = "C:DATAPAYROLLMYACCTS.MDB" strPath = GetPathPart(strFullPath) MsgBox "The path name is " & strPath
Function GetPathPart(strPath As String) As String ' Comments : Returns the path part of a string ' Parameters: strPath - string to parse ' Returns : path part ' Dim intCounter As Integer
For intCounter = Len(strPath) To 1 Step -1 If Mid(strPath, intCounter, 1) = "" Then Exit For End If Next intCounter
Hi I'm not sure if i am posting this in the correct area but i'm guessing that since i am starting of in access this is the best place to start.
I am wonderin if it is possible to create an automated procedure that will export several access tables into XML format and then using a server upload them into a SQl Server database.
The reason for this is I want to keep the information on the website as up to date as possible whice means taking the data from the access and firing it accross. currently we have a procedure in place that we run to create the xml documents and then i run a ASP script that deletes the SQL table and then creates a new one using the xml, this is quite timely and means the website is not consistently up to date.
can any of you think of a way for me to automate this procedure and to make it more effecient.
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 would like to have an access database loaded onto a few laptops that go out into the field. when they come back with their data I want them all to be able to upload their new data to a mysql database on the web. is this overly complicated?
Dear all : 1- I want some thing to brows the file any file 2- and after browsing the file >>> selecting the file needed!!!! 3- after selecting the file I don't want to open the file What I want : I want to save (the path of the file to variable ) or text box Example: D:MyExcelbook.xls The variable will hold Dim MyFilePath as string MyFilePath = "D:MyExcelbook.xls" Thank you