what I would like to do if possible is for this to look at the first line in the table but I want to use this part of the code for 4 or 5 different paths Is it possible to modify the code so when I use it 5 times each code looks at different lines in the table
I am trying to export a query or table to a location that the user selects. So each time the export button is clicked the folder will change. But I want to be able to select the folder.
The code I have below is saving but not to the folder I want it to.
Private Sub CommandBtn_Click() Dim fileSelection As Object Dim strPath As String Set fileSelection = Application.FileDialog(4) With fileSelection .AllowMultiSelect = False If .Show = True Then
I am after a script to change the linked table paths like the following.
It will only ever be the path that is changing not the file name and only ever linked tables
Code: for each table in tabledefs if table.path = c:Testing* then table.path = w:Testingfilename if table.path = c:Jobs* then table.path = w:Jobsfilename if table.path = c:Quotes* then table.path = w:QuotesNewfilename next table
What I'm stuck on is the filepath. The file path changes everytime. So I would like to have either the open dialog box (I've tried many different versions that I found on the web.) or to search by the account name for the folder and place the text file in there.
Here is one that is closely working how I want it to:
This is a function that I found, that opens a dialog box for the user to select the folder location. It works, but I can't seem to get it to work properly.
It prompts, the location, then once you select it and press ok. It will add the folder name to the full file name, and place the file in the default root path. Not the selected folder path.
So in the end it will look like this:
D:1_MainMyFolderName_MyTextFileName.txt
I'm somehow stuck on getting to seperate the file path from the file name, so you it look like this:
D:1_MainMyFolderNameMyTextFileName.txt
Code:
Dim MSg As String Dim SelectedDir As String Dim SelectedDirFinal As String Dim SelectedDirName As String Dim StrFolder As String
[Code] ....
I think it should be something very easy, that I just need a pair of fresh eyes to look.
I've tried the Fileobject, FileFolder method, but can't get the quite work properly.
I need some simple code that will copy an Excel file or a table in Access to a specific location on an FTP server. I would think this would be a very simple task, but I have yet to find any sample code that is *simple*. I have seen lots of code that requires downloading this dll or that mda, but the examples don't work. There must be something built into MS Access 2010 that will allow a file to be uploaded to an FTP site.
All the variables are known:
The FTP location (it never changes) The FTP Username and Password (they never change) The destination folder on the FTP site (it never changes) The File type (it never changes) The File name (available from the form in Access from which this will be executed)
I can either produce an output file, then copy it to the FTP site, or I can export the table directly to the FTP site with the file name for that day.
This seems to be a very simple task with no simple solution. Currently I am using an FTP app to get the file to the FTP site, but I would like to automate this. The process that creates the output file is already automated, so I would just like to add this to the existing code as its own module.
just made all that above up and none of it is a real function/command in VBA, but is just the kind of thing I'm looking for.
I would think that since I can download and XML file from an FTP site that it should be child's play to upload a simple file to an FTP site, but I can't figure it out.
I would like to create a form that allows me to search for a folder on my desk top, then once located i can transfer that file to a specific location on another drive, Similar to the Browse / upload function you see on many applications.I am using Access 2003. Is this possible??
how to stop this error from occuring. "Potential Security Concern" I get this everytime a query runs that is creating a file for exporting. The database is in a trusted location, the query is a make table query if that makes a difference.
I need a module but haven't got the foggiest on where to start. I have a query that works out whether a staff member has done a sleep in based on their clocking out time (TIME OUT). I also have a column for DAY IN which it stores the day they logged in and HOUSE which indicates which house they clocked in at. What I want to do is determine whether each 'sleep in' is a weekday or weekend shift and at which house. We have different rates of pay based on the houses and whether it is weekend or not.
The code below sets my printer to "Cute PDF writer" and then opens a report in print view, which creates a PDF version of my report. So far so good. But just before the last step, it brings up the Save As dialog box, asking for a filename and location.
Three points are important:I always want to call the PDF document "Specialty Report".I always want to save it to C:Documents and Settings80435 Desktop. I always want to overwrite the previous version.
Is there some code I can insert that would achieve this automatically with no further user interaction i.e. user clicks a button and the PDF file is created/overwritten?
Code:
'Produce the report Dim defPrinter As String, NewPrinter As Printer defPrinter = Application.Printer.DeviceName 'Get the default printer name Set NewPrinter = Application.Printers("CutePDF Writer") 'Create a new printer object Set Application.Printer = NewPrinter 'Set the default printer to the new printer DoCmd.OpenReport "Specialty Report", acViewPrint 'Open the report in print view (which will PDF it) Set NewPrinter = Application.Printers(defPrinter) 'Reset the printer back to the default printer
I have been searching all over on how to create an import button on a form in access 2010 where I can set which table it should copy the data into but the user could locate the import file.
NOTE: the reason being I have locked all the ribbons...
If necessary I could make a specific import template file which would have all the headings locked...
I have a table in msaccess which i would like to use as a search term to search values in another table. What i wanted to do is search the table with attributes and save all found attributes to a new table with its primary id.
Search_Keyword_Table Id ---- Search_keyword 1 ----- Size - S 2 ----- Size - M 3 ----- Size - L 4 ----- Size - XL
Background: I have a database that keeps track of containers -what they belong to, and what is in them. Each container has a “Call #” which is labeled on the container and is a primary key in the database. The “Call #” field is set to only allow 5 characters in this field. A standard “Call #” for example is "A 152". When a new container comes into the system, which has not been physically labeled yet, I enter it in the database a little different. So let us say container "A 152" just came in, and has not been physically labeled yet. I enter the “Call #” into the system as "MA152". The "M" tell me it still needs to be physically labeled. When I go to label all the unlabeled containers, I print a report with all the "Call #''s that start with "M". I have another field in the same table called "Mark". In my forms I can then go through and click a "Mark Button". The Report prints all containers where the "Mark" field = yes(True). This feature is used for a number of different reports, not just unlabeled containers. To keep the database clean and in order, all “Mark” fields reset to no(false) whenever it opens up. Because, I used the “Mark” field for other reports, simply clicking the “Mark Button” when I enter the new container into the system will not work.
My Question: Is There a way to have a Query search for the first letter in a field. So when I go to print my report, a query runs looking for all "Call #s" that start with the letter “M”.
When creating an incoming inspection database, I want to set it up so when I am in a form to add data, I want to have a command button where I can pull up the associated CAD drawing based on part number and drawing number. I would like to enter the directory location into a table so I could change it if I need to.
I have created a database that tracks the locations of all the faxes we receive in a day. We have a dedicated employee that enters them into the database as well as who they are assigned to and other pertinent information. At the end of the day, I monitor the network folders where the faxes are saved to change the status of the fax in the database to done, still needs processing, or awaiting approval. Is there any way that I could set up some VBA that would automatically update the status column for the record based on the location of the file? The file name is recorded in the database so then if it sees that that file is in the end folder it could automatically update the status to finished.
The response I got on another forum is as follows:
-The impression I'm getting is that you've got a database of information over here. -And it lists the file name, but not location. -And then you have a physical folder structure with the fax files in it. -And there are folders for done, awaiting approval, or processing. -So what you're looking for is something to read those folders and update the status column based on which folder it is in? -So at the start of the day we have:
New -Fax1.tiff -Fax2.tiff -Fax3.tiff -Fax4.tiff Finished - In progress -
And at the end of the day the folders look like this: New -Fax1.tiff Finished -Fax3.tiff -Fax4.tiff In progress -Fax2.tiff
And you want your code to browse those folders, and update the status of each filename based on it's folder?If the filenames are unique, you can just use VBA to open the folder, create an array of the files and then set the status. Create two separate functions, one for in progress, one for completed and call them one after the other. There'd be no need to check the current status, but you could store the wrong status if a file is duplicated, or a filename repeated.
see below the code . The select statement searches the Printpoolno value from the top to bottom in table tblmaster. As in my table tblmaster there are thousands of records and it takes long to search for that Printpoolno from the table . Is there anyway we can write a query that will search the table from bottom to top as the Printpoolno will always be in the bottom records and not in the top records.
Code:
Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim r As Long
creating a VBA that will allow me to search for a record in Table A, and once the record is found, allow me the option to add that record to Table B. Is this possible to do if Table A and Table B are not formatted the same (i.e. one has more fields than the other)? In summary, creating a VBA that will allow me to search in one table and once the correct record is found, allow me the ability to add it to another table.
I have a form which has a combobox called Task_Ref which looks up values in a table column.
I would like to be able to set the tickbox value of tickbox called P1 to True if the combobox contains the word "test", each entry on the combobox selection may vary such as:-
Test number 1 Yesterdays Test
As long as the word "Test" appears I would like the above to happen?
I was thinking of something along the lines of:-
If InStr(Task_Ref.Value, "Test") > 0 Then P1.Value = True Else P1.Value = False End If End Sub
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 want to create a button on my form that when pressed will scan my multi page document (ADF) from my Epson WF-3540 and save it as a specified file name and folder.
I'm currently working on a database to track and inventory documents in my organization similar to a library catalog, but with a digital archive as well. I'll need the ability to "attach" documents to records in the main inventory (though using links instead of storing it in the db) and have the documents live in a centrally accessible location on our shared server.
I will need to have this function work through a few different tables and in a few different iterations, but I'm trying to work on the simplest part first, which is attaching a thumbnail/preview of a given document to the record for that document.
I've got some VBA working well which opens the file picker and copies the file to a directory relative to the DB. It also creates a folder with each employee's ID number if it doesn't exist already (which it gets from the Windows log in) and adds "Copied_" to the front of the file.
Now I'm trying to get the VBA code to interact with the record. Presumably I need to tell the form button I'm using to launch the VBA code to pass the primary key of the record being displayed to VBA. Then, at the end of the VBA code I need to take that value and find the record again from VBA so I can update the MediaThumbnailLink in the original record.
Does this order of operations make sense? If so, how should I go about passing these values back and forth and writing the new link value?
Here's the VBA I'm using so far...
Code: Option Compare Database Public Sub GoCopyThumbnail() Dim fDialog As FileDialog Set fd = Application.FileDialog(msoFileDialogFilePicker) Dim varFile As Variant Dim LUser As String