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 copied some VBA from one database to another. I didn't change anything and I am able to run it fine in the first database. But in the DB I pasted it to, I am received a Compile Error message with the XlApp As Excel.Application area highlighted.
Function OpenAutoCount() Dim xlApp As Excel.Application Dim xlWB As Excel.Workbook
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'm trying to import a pipe delimited text file into a table. I can import the entire table using the following code, but I only get one column of data (the entire data set in one column). If possible I would like to import with the columns defined or if not possible use some code for a function similar to text to columns.
I had to delete a database so I exported selected records using export as a text file thinking I would get some sort of delimited text file that I could later use. Instead I got some sort of fixed length file with .............. between records and | between fields.
I'd like to convert this data to a tab delimited file.
A little background. I need to export the results of a query I use to build a report. For Print Master software I need the "Field Names" in the text file as well as the data for a Mail Merge in Print Master (PM).
"The field name information in the file you have specified is missing or not correctly formatted. The first line of the file must contain the database field names. Make sure the "Export Field Names" (or similar) option is selected in the program from which you are exporting data."
Trouble is, when trying to export the report or query, Access has no "Export Field Names" option. It works if I first export to Excel and then from Excel to "txt" then to Printmaster. I would like to eliminate the Excel step. Therefore, how do or can I get Access Export to transfer the "Field Names" along with the field data?
I have used the following script to export a subform to excel but it isn't working for a report.
The report name is spelled correctly etc... but the error message keeps saying error 2465 or if I enable the error handler it says application defined or object defined error.
I don't want to have to export the data to a table first, but if I have to then I guess I will have to.
Code: Sub fFunctionNameExportExcel(ctrl As IRibbonControl) 'print to excel Dim rst As DAO.Recordset Dim ApXL As Object Dim xlWBk As Object Dim xlWSh As Object Dim fld As DAO.Field Const xlCenter As Long = -4108
This is giving me the error 'User defined type not defined'. I know I have to set something in a list somewhere but have forgotten how to do that. Where to go, and what to set?
I'm trying to create a database for a construction company, as an experiment more than anything, and my problem is this:
I need to create a set of identical records in the table "buildings" based on the information entered into a text box by a user on the form for registering a new project. I want each record to be identical except for the "plot number" field, which I want to start at one and increase to the number of buildings defined in the text box.
"Projects" is one table and "Plots" is in the other.
I have quite a few user defined / custom functions which I would like to be available in any new database that I create without have to copy the VBA codes in a module each time. Basically, some sort of add-in that loads on MS Access startup may be (but I am not too sure - never created one). So something that will start with the MS Access Application and not just a particular database. I know excel addins can be copied to the XLStartup folder to achieve something like this in excel, but not sure about Access.
On Compiling my assecc database VB code I get the following error message "User defined type not defined". I understand it is beecause I have not declared the Variable Type, but have no idea to exactly which part of the code the error is referring to.
How do I find out WHICH User defined type is not defined, especially when I have not got any (or do not want to use any) user defined types?
Thank you in advanced programming wizards. Kind regards, Adam.
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 trying to import a text file with 273 fields into two tables. I've been able to do this with the code I found on an old thread and I'm now trying to accomplish everything with one step. The file I'm importing is tab delimited text file. With this current code I'm only able to populate the first record in the table and then I get error message. (Run-time error '3265') (Item cannot be found in the collection corresponding to the reqested name or ordinal).
Code:
Public Sub ImportTextFile() ' to use the ADODB.Recordset, be sure you have a reference set to ADO Dim rst As ADODb.Recordset Dim rst2 As ADODb.Recordset Dim strFile As String Dim strInput As String Dim varSplit As Variant Dim intCount As Integer
The database I'm working on stores label images, or better stated, it stores file paths where the label images are stored. These paths are used in reports and forms to view the label images within the database. What I'd like to do is to create a "save" or "email" button that will allow the user to select a location to save just a copy of the image in jpg format. I realize that it is possible to imbed the jpg image into a report and export it as a pdf. What I'd really like to do is find a way to save the image (perhaps by copying it from the path in the database and simply relocating it) and preserve the jpg extension if that is possible.
I am also aware that there are third party applications that will convert pdf reports into jpg files however network restrictions keep me pretty limited in my ability to download third party software.
I need to create a command button to import a tab delimited text file into a table in Microsoft Access using VBA Code.
I have set up the button however I am unsure as to how I should approach it and what code i need. If anybody has any suggestions I would be very grateful.
I've got an access table with six fields, all of which are text fields. I have set up an export specification file in order to export the table as a tab delimited txt file. However, when I export, the output file is not lined up in columns!
What I am seeing is:
1 A BB CC DD EE 2 f GG H I J 3 kk LLMM NN O 4 PP Q R S T
I've tried a manual exort, using the Advanced tab for my specifications, with the same results.
If anyone can lend some ideas or suggestions, I would be very thankful.
Thanks in advance..... looking forward to your replies!
I just want to export a query table manually to a tab delimited file. I choose text try setting the file extension to .tab as well and I wind up with some sort of fixed width file.
I know this because when I open it in Excel it has the | symbos and so forth.
It's as if it is calling for an export spec, but I'm not aware of needing to do this when exporiting manually.
It seems like I have done this numrous times without this problem.
In an Access 2010 form is it possible to export select records and fields in those records to a specific location?
Code: Set objDialog = Application.FileDialog(4) With objDialog .AllowMultiSelect = False .Title = "Please select a File" .InitialFilename = "C:" .Show If .SelectedItems.Count = 0 Then MsgBox ("Action Cancelled") Else
[code]....
The user can select the directory using the code above, but can specific fields in records be exported to a excel workbook in that selected directory?For example, if the are 5 records in the database can the fields LastName,FirstName,BirthDate in records 1,2,3 be exported to Setup.xlsx in that selected directory?
So I have this relatively simple problem: I need to create a button that once clicked will open the Save As dialog box and allow the user to save a copy of the current database where he wishes. The filename should contain todays date in DDMM format along with some pre-set text e.g. DDMM PresetText.
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
hi everybody, im have a database with table called "project". there are many column in this table. my user want to export this table to Excel, but only some of column, with particular order ( depend on him) to analyze in Excel. he asked me to build a form with a list box, drop box,somthing like this, so he can choose what column to export in what order. i try to make a query like this: " Select Forms!UserInput.combobox1.value , Forms!UserInput.combobox2.value,etc, From Project" but it wont work. Dou you have any idea. thanks in advance