Where the section highlighted is a combo box on a form. I was trying to use the value in this combo box to describe the filename of the text file I was exporting to. However I get the error:
The Microsoft Jet Databse Engine could not fond the object 'X#txt'. Make sure the object exists and the you spell it name and path name coreectly.
Where X is the string stored in the combo box.
Any ideas where I have gone wrong/what could be improved?
I have a report that i send with a e-mail (via a macro), the exported values of the report are send as a .txt-file. Now something strange happens, between every 4 or 5 lines of text there is a blanc rule, this i want to get rit of!
So the textfile looks like:
qsdf sdfg dsfg
xcvb xcvb rty rtye
ezrz zerz
etc. etc.
When i send the report as a .rtf-file there are no blanc rules inbetween, so the problem lies not in the report itself i think. But it needs to be send as a .txt file and not as a .rtf file, so if anyone knows the reason (or solution) i would be very happy! Thanks already and kind regards, fvd
Beloved Access gurus,I am wondering if it's possible to export specific columns into certain positions in the textfile? I haven't seen this done with Access before so i dont know. I have an access table that i would like exported periodically into a textfile (meaning, i have to do this with vba).For example - loop through table, exporting into textfile:column 1 ---> start on 1st line Position 20 in the text file (after 19 spaces)column 2 ---> beginning of next line.column 3 ---> back to previous line, position 40.Is this possible? If so, any thoughts or suggestions will be greatly appreciated.
Err.number = 5174 Err.Description = "The file cannot be found" Try one of the following things: * Check if you write the name good * try an other file name (document2.doc)
The file document2.doc does really exist and is saved in the same directory as document1.doc
the problem is sometime I get the error message some times not in this last case it works very good.
I'm making a macro to output a report to an Excel spreadsheet using OutputTo and would like to add the date to the filename since this is done each day and the files need to be different. So I'd have something like "Output" as the base filename and "Output20050628" as the final filename. Would someone please help me out on this? Thanks in advance.
I think I am on the right track, but I am stuck with importing the date from my excel filename. Currently the following code imports all Excel files from the directory into a table in my database. The excel files are saved like "ABC_BNG_GTR_04012008.XLS" The numbers represent the date. I need for the date to be extracted and place in table into the "callDate" field. When I run my code, I continue to get a runtime error 13 - type mismatch. The code stops at the Mid() statement. What am I doing incorrectly? Thanks in advance.
Option Compare Database
Private Sub btnImport_Click() Dim strFile As String 'Filename Dim strFileList() As String 'File Array Dim intFile As Integer 'File Number Dim filename As String Dim path As String Dim TheDate As Date
'Loop through the folder & build file list strFile = Dir(path & "*.xls")
While strFile <> "" 'add files to the list intFile = intFile + 1 ReDim Preserve strFileList(1 To intFile) strFileList(intFile) = strFile strFile = Dir() Wend
'see if any files were found If intFile = 0 Then MsgBox "No files found" Exit Sub End If
'cycle through the list of files For intFile = 1 To UBound(strFileList) filename = path & strFileList(intFile) DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "sheet2", filename, False
'Inserts date in date column based on file name
TheDate = Mid(strFile, 12, 8)
CurrentDb.Execute "UPDATE sheet2 SET callDate =" & "'" & TheDate & "' where callDate is null"
I got a headache to changing my form's filename... i am totally a newbie in Access while in the few months ago... so i just create all those form or table name's for the way i like. But now i had already know how important of management of the filename because when u r using the module to write the code u will be headache to look for the filename that u want in the code. So that is important to add 'tbl', 'frm', 'Qry' infront of the filename.
So do anyone have a good way to edit all the file name with all match to the other in the module with a quick way rather then one by one editing (really tired for one by one) Thanks!!!
I have a replicated database. I'd like to display the name of the version of the database that is being used on the data entry form so it's clear which version is being used.
What's the code for the current filename? (I'm talking about the entire "filename.mdb" file).
Good morning, I have a listbox that contains dates (0105, 0205, 0305, etc.) and depending upon which date is selected in the list box, I want to import the corresponding month's text file. Here's the code:
Private Sub List64_DblClick(Cancel As Integer) Dim frm As Form, CTL As Control Dim VARITM As Variant Dim X As Integer Dim period, PERIOD1 As String period = Me!List64.Column(4) PERIOD1 = Me.List64.Column(0)
So I have the files saved on the above mentioned S: drive, i.e., MDRF_0105 and when the user selects 0105 in the listbox, I want the appropriate file to be imported.
I've posted this question in the Excel Forum, but maybe it's better suited here. I need some help with an excel file that is created from an Access Query. I’ve managed to create a button on my form that creates the .xls file and open excel, but the formatting is wrong. I need to define the columns in date and time format so that the created file looks right. I’ve already tried one suggestion to change the default .xls file to be the format I need, but that didn’t help. Is there any way to do that? I really appreciate any help I can get. Cheers. -Tom
I was wondering if it is possible to pre-processes queries before they are exported.
I wanted to do a few things like, conditional formating, column widths and some simple formatting.
I currently have a macro to export to an xlsx excel spreadsheet and i dont know if i can code in the formatting or if i have to create an additional excel spreadsheet with the macro on it so that I can do this:
In Access --> Export Query Open export Open Pre-programmed macro run macro save the export with the macro completed close macro
I am trying to create a unique filename when sending a report via email in snapshot format.
As already stated in another thread, the filename comes from the report's "caption" property.
Can a unique filename be given in a case like this? I need the filename to be a series of concatenations of field names.
This report will be sent one page at a time. And sent by seperate people as many as 100 times in a single month. And as much as 1000 times in a single year. Each page (report) will be stored on a sever. So saying that, the need for a unique filename for each time the report is emailed is very important.
I need to import a number of .csv files every day and overwrite the old tables with the data from the new .csv files. However, each day, the filenames will change.
For example,
Day 1: Import fileA 1.csv, fileB 1.csv, fileC 1.csv Day 2: Import fileA 2.csv, fileB 2.csv, fileC 2.csv Day 3: Import fileA 5.csv, fileB 5.csv, fileB 6.csv
The files will be named fileA [#].csv, fileB [#].csv, fileC [#].csv, and so on, with a different number each day (with no pattern to the numbers).
Is there a way to write an import specification or VBA script that will import these? Perhaps something that allows a regular expression in the file path so I can import "C:fileA*", "C:fileB*", etc.?
Tried to export a report to Excel using Tools>Office Links>Analyze It With Microsoft Excel menu. The order of the fields appearing in Excel doesn't seem to match the order on the Access report layout. What is the logic on how the fields exported? Thanks.
I'm exporting a query that has currency values in with no decimal places but when it's viewed in excel it has 2 decimal places! I've changed the properties in the query to none, how to stop this from happening? I'm using 2003.
We have a large health database, with several data entry individuals, that has run for many years.I use input mask >aC to force the table entries to appear as though sex is F or M even if entered accidently or in the past as "f" or "m" and also >aCCCCCCCCCC to make all names consistently in capitals.
I use > in formatting to be sure reports from the table are printed as capitals.
Frustrating me is that when I export the Access database into my statictics program for analysis, physically what was originally entered is exported e.g Smith, SMITH, smith, smiTH. I want it to appear as only SMITH in my export.Currently to data clean, I remove the masks and physically go through the data to ensure consistency before exporting.
I have this report that needs to be export - 1 report per record
The report exports out but its the same record export out each time ( the name changes - but the data doesn't)
Code:
Private Sub Command0_Click() Dim MyDb As DAO.Database Dim rsemail As DAO.Recordset Dim RefernceNumber As String Dim FilenameZ As String Set MyDb = CurrentDb()
I have a query that runs the saved export that exports data to an excel spreadsheet. When I go to run it again, it does not update the spreadsheet with the new data.
I am writing some search results to an excelsheet for reports using the time and date functions to build a filename. I downloaded a StripSpecialCharacters() module, but it doesn't take them all out (only takes ascii above 127).
Does anybody know of another function to do it. searched the archive to no avail.
Need a formula which can capture filename for me. For example, I have a db saved at "C:DlocationofficeChina.accdb". Is there a way to capture "China" in a query?
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
The command button has the code below, it works great and pops up with a window with the file name and path. I now just need the code to insert the file name and path into the table....
Code: Private Sub Toggle7_Click() Dim f As Object Dim strFile As String Dim strFolder As String Dim varItem As Variant Set f = Application.FileDialog(3)
Hi I wonder if anyone can help? I have looked through prevous posts and cant find any answers that fit what I need to do. For reference I am using Access 97 and Word 97.
I want to be able to have a client record open in a form and click a button and for that particular record to merge with a preformatted word doc. I have created a query that gives me all the fields I need (as they are over multiple tables) and I can successfully combine this into a mail merge. But it currently takes *all* the records and I want it to only do the current one. I also want user to be able to click a button somewhere on the form that automates this process for him. Is this possible?
I have investigated transfertext and filled in what I think I should have but it seems to do nothing. It creates another (unopenable) file in the same folder as the word doc and does nothing else. But I am using the 'export word for windows merge' in the tranfertext action?
If I can only crack this I will be happy! Many thanks in advance for any help
Hello , I have a date format problem , I have an access database which when run by a macro, gives me a date format of 05-AUg-05( data type is text)and the same applies when it 's exported toexcel , it appears as 05-Aug-05. But , when exported to excel i need it in the format 05/08/05. What should i do for this ?
I think the problem is ,When I run a macro i think the date field is automatically assigned to text , what should i do so tht when it runs a macro it should be in date/time type ?