How To Get Filename To Show Up Next To Attachment Box
Mar 13, 2012Is there a code to get a filename to show up next to an attachment box?
View RepliesIs there a code to get a filename to show up next to an attachment box?
View RepliesI have a table with an attachment field in it. I want to show this attachment field in a form
This attachment is a picture (I want to have the exact picture in my form).
dears members,
I m trying to add document2.doc to document1.doc by clicking a button on a form.
I use the next VBA code.
Selection.InsertFile filename:="document2.doc", Range:="", ConfirmConversions :=False, Link:=False, Attachment:=False
I get the following message error:
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.
can any body help me ?
Thanks in advance.
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.
View 3 Replies View RelatedI 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
DoCmd.SetWarnings False
path = "C:UsersChinaboyDesktopData"
'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"
Next intFile
DoCmd.SetWarnings True
End Sub
Hi all,
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)
DoCmd.TransferText acImportFixed, "df import specification", "LOCAL DF-SL", "S:FinanceAccounting OperationsNational AccountsAccount Recs116406-Account ReconDF_" & PERIOD1
DoCmd.TransferText acImportFixed, "Rf import specification", "LOCAL RF-SL", "S:FinanceAccounting OperationsNational AccountsAccount Recs116406-Account ReconRF_" & PERIOD1
DoCmd.TransferText acImportFixed, "MDdf_import_spec", "LOCAL DF-GL", "S:FinanceAccounting OperationsNational AccountsAccount Recs116406-Account ReconMDDF_" & PERIOD1
DoCmd.TransferText acImportFixed, "MDRf_import_spec", "LOCAL RF-GL", "S:FinanceAccounting OperationsNational AccountsAccount Recs116406-Account ReconMDRF_" & PERIOD1
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.
This code is set on the DblClick event.
Please help!
Thank you!
Hi All,
I have this line of code:
DoCmd.TransferText acExportDelim, "Dhcp Specification", "tblDHCP", "U:" & [Forms]![frmExportDHCP]![cmbServer] & ".txt", False, "", 850
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?
Cheers,
Matt
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.
Thanks for any assistance on this.
Tasha
For instance, I got some dynamic length path with filename as follows:
F:OUTDOOR9-8W1250832 ABCworking 1.3-0.6 BOARD 720.tif
Is there any easy way to get only the "working 1.3-0.6 BOARD 720.tif", which is the desired filename.
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.?
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.
Thanks in advance
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?
View 2 Replies View RelatedThe 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 a table named tbl_imagepaths with fields:
ImageID
File
Folder
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)
[Code] .....
I am working on supporting spaces in the DB filename. I got the rest of my program working... other than being able to invoke Access with the specified filename for it to open.
Code:
C:Documents and Settingsc_mlueckMy DocumentsFandango>"C:Program FilesMicrosoft OfficeOffice12MSACCESS.EXE" "Schema Ideas.accdb"
C:Documents and Settingsc_mlueckMy DocumentsFandango>dir "Schema Ideas.accdb"
Volume in drive C has no label.
Volume Serial Number is C8E4-5856
Directory of C:Documents and Settingsc_mlueckMy DocumentsFandango
01/18/2013 04:45 PM 3,203,072 Schema Ideas.accdb
1 File(s) 3,203,072 bytes
0 Dir(s) 125,846,482,944 bytes free
The envoking of MSACCESS.EXE results in:
Does Access 2007 MSACCESS.EXE not support DB's with a space in the file name being spefied to auto-open via command line switches?
I need to import 300+ individual .txt files into a MS Access DB table (named "tbl_input"). Each of the the .txt files have a naming convention similar to this:
Pink_Floyd_YYYYMMDD.txt
Because this initial import is so large and I would like to avoid doing it manually, I need to be able to:
import each of these files into a single table
delimit the text in each based on the "|" symbol
add the filename into an empty field
Is it possible to create a button that automatically saves a report as .pdf? And automatically generates the filename.
Like 0810-544 (0810 is the date and 544 is the ID from the form.)
My access is 2013.
Suppose there's a simple query which has two fields, "year" and "graduates", where "year" can be grouped by "2012", "2013", etc and "graduates" are individual names.
How can I export the list of graduates to multiple excel files, with the filename based on "year"?
I have tried to set the output file in macro as "c:desktop" & query.year & ".xls"
But it's not working and the output filename is exactly "&query.year&.xls "and the file contains all year and all names.
Hi,
I was wondering if it's at all possible to add an attachment which is a pdf file to an email? I've searched this site and can't seem to find anything on this.
Thanks
Geno
Is it possible to attach an email in a field of a form?
We have a database that keeps track of technical orders. We get e-mails on what we are supposed to implement on a particular tech. order. Is there anyway I can attach or make a copy of this email or something to have it in a field of my form?
Thanks.
How can I select Current Record of Subform by Double Clicking to another Subform.
See The file...
Intead of Subforms if anyone do it with ListBoxes will apprecited...
Hi all,
Is it possible to attach/store files (Word, Excel, etc) in a database table?
Appreciate your feedback.
Thanks.
Hi,
i need to attach files through a form.One could be able to browse for the file and attached it with the mail.
thanxx.
Hi all,
For my db, which has send object command to send a *.snp report in email object, I want to include some more attachments. On click event should get the files from a local drive and attach to email message along with report.
Could some body help me towards this point?