I'm trying to work out how to attach a word doc to the attachment field of a table when I add a new Record. The following code work's fine if I add it to the On Load Event on the Form, but the doc is attach'd to the first record. When I add the code to the Add New Record button, I get the error msg: "File already part of the Multi-Valued Field" and nothing in the attachment field.
Code: Private Sub Add_Record_Click() DoCmd.GoToRecord , , acNewRec Me.Description.SetFocus On Error GoTo Err_AddImage Dim db As DAO.Database Dim rsParent As DAO.Recordset2 Dim rsChild As DAO.Recordset2
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 am creating a inventory database for work. I am trying to get the cursor to jump to the next text box for data entry using a barcode scanner. I have a limit on how many characters there can be in this field but yet even after it is all filled the cursor stays in that same field. I am fairly new to access, especially in code building. Do I use "After Update" under "Event" in the "Property Sheet"?
I am currently in the process of creating a form that will allow you to enter details for an email sent, select a number of documents from a list box and then open the mail message pre-written with attachments. The attachments reside in a list box currently, and I am attempting to use a "For Each" with item selected.column(3) as the file path, as column(3) contains the filepath from the table.
Currently my code is:
Private Sub OutlookBut_Click() Dim olApp As Object Dim objMail As Object Dim varItm As Variant On Error Resume Next Set olApp = GetObject(, "Outlook.Application")
[Code] ....
When this code runs, outlook will open as a process when it is closed, but then freeze and not allow me to see it or access it in anyway. If Outlook is opened Microsoft office usually gets angry at me and decides to throw error messages at me.
I need to create a word file (it needs to be word) based on template (not a very complicated template) max 1 to 1 and 1/2 pages long.
the word doc needs to be named from the recordset but for now assume 12345.doc and the next one will be 12346.doc etc (I have a unique number system - available from tables /query .
i can either make the word doc in code or use a template (template would be better) recordset could have 20-30 in it each time i run it - but to be run every week
second half is how to email this out. i had in mind a email system
email to . test@testhotmail.xyz file attach = this folder where the docs are store and attach 12345
in a loop
so either
create word file - email word file in a loop each time or create all the word files and then send them individual
I have some code that loops the clone recordset of my subform and generates a email with attachments. I have mainform and continuous subform within the subform I have field called address this holds paths to files and another field called send and this is a yes/no field
Now what I'm trying to do is loop through the subform if send field is true then attach file from the address path but if send field is false then do not attach file
Code: Dim olApp As Outlook.Application Dim olMail As Outlook.MailItem Dim olAttach As Outlook.Attachment Dim rstAttach As DAO.Recordset
Set olApp = New Outlook.Application Set olMail = olApp.CreateItem(olMailItem)
Am working in MS Access 2013 and I have a form with a button, I need the button to doattach automatically the pdf-report to the email template(i don't want to attach the pdf to a new email)
Right now the command open the E-mail template and create the pdf-report in the desktop
Code: Private Sub Command18_Click()
Dim oApp As Outlook.Application Dim oMsg As Outlook.MailItem Dim oAttachment As Outlook.attachment Set oApp = New Outlook.Application
I'm sure this is a simple issue, but so simple I can't find the answer.
I have a recipe DB and have calories and fat and fiber fields, I want to have another field which will display a point count for a formula (calories/50+Fat/2+fiber/5) but the catch is if the fiber number entered is over 4 I only want the calculation to use 4 max.
Not sure how or where to create this formula to populate a field in the DB.
As you can tell I'm new to all this and any help would be appreciated.
I have a subroutine that works well for sending emails. A need has arisen to, in some cases, send an Access report as a PDF attachment. I know how to do this using the SendObject method, but that won't work in this app. I also don't want to have to first save the report as a pdf file. I think I'm close, but I don't know the syntax for passing the report name as the Source parameter in the Attachments.Add method.
Code: If strEmailAddress = "jsmith" Then .Attachments.Add source:=MyReportName, type:=acFormatPDF End If On Error GoTo SendErr .Send On Error GoTo 0
I have been tasked with setting up a certificate request database. I have an Access 2032 FE & SQL 2012 BE. I need to store PDF documents from all our branches.
I have been working on this for the past 3 working days and I have seen a great deal about saving the file path to the database vs saving the actual document in the DB. The documents would be located on each users computer.
I have a Form with all the information that is required by the certification department. On the form is a button (Called InsertID(ID in this case is the persons Identity Docuement)) and the button is linked to a table called dbo_CertificationSupportingDocuments. The table is referenced to the Main Certificate Request table.
The dbo_CertificationSupportingDocuments table is structured as follows:
I would also like to automatically attach on the server to this email. Such a file stored such as servernamesharefilename.pdf. Is it possible to do this?
This PDF document is attached to an MS Outlook e-mail and sent without any intervention from the user. This is accomplished using further VBA code. This code is working at the moment sending both Excel spread sheets and PDF documents but the PDF's require the page formatting before sending. I want to be able to accomplish this without having to open another application such as Adobe Acrobat.
a) Open a word document from MS access / VBA, b) Connect to data from a query c) mailmerge it d) Save it as a new document containing mailemerged letters.
The code does open the required document as I can see it open.
I put a message box to recheck that filename/path is what I mean, and to to know till which line the code runs. Code runs till that point and that word doc is seen open. I get the error message before
Then I get error message.
I was fooling around and was getting message " This command is not available because no document is open" I tried to remove few lines thinking redundancy. Before getting the message, I was also getting the error trapping message "No documents opened."
Now I am getting different message.
I am getting message " The remote Server Machine does not Exist or is unavailable"
Following is the code I have written.
Dim xlApp As Object Set xlApp = CreateObject("word.Application")
We need to replicate an Access report we have in Microsoft Word. The report has a fixed, small image in the header and so we embedded it in the report (it is not in an external file). To put this image in the Word document the only way we have come up with is shown in the code below.
Code: Dim apWord As Word.Application Dim doc As Word.Document Set apWord = CreateObject("Word.application") doc.Shapes.AddPicture "G:ImagesSinful Banner.bmp", False, True, 0, 0, 540, 42
Which requires an external image file. We really would like to avoid this. We could make a template Word document, but that too would be an external file. We know how to put this image in a table as an OLE object, but can't find any way to get it from the table into the Word document.
When I execute the below function I get an error. If I use the commented out "Open" line it works fine. I get Run-time error '52'. Bad file name or number.
Private Sub GenerateSSA_Click() Dim strRA As Variant, strFileNew As String, strFileBlank As String Dim intFileOut As Integer Dim rstWork As DAO.Recordset Dim dbs As DAO.Database Dim qdf As DAO.QueryDef
I have built a simple database (by no means complete) but I am after adding some further code into it. Basically on the form [FrmMain] I have a button that allows me to send a document to a relevant CSU contact. It finds the file name based on the info in the table TblResident. What I want to do is open the word document before sending and add a password to it using vba.
I have been trying to populate a merge document from access. I have the dotx files organised and the recipient file (Query) within my main access project. The following code opens word, opens the selected file (dotx) but can't find the db file.
I am using access 2010 and .accdb database format. I have temporarily put in MsgBox lines to display the running content of fields and they are producing the right info.
Private Sub DocumentsCbo_Click() ' load precedent template as a dotx, merge fields into precedent document, allow user to modify if needed, save it as a pdf On Error GoTo ErrTrap Dim MyPath As String ' Path of the source template Dim DestPath As String ' Path of destination document
Not sure if this is possible but I am trying to extract data from a word document to set up a database.
Basically I am trying to capture data from completed forms, similar to the sample attached, the actual blank form is 20 pages long and once completed can be as many as 30 pages, or even more, although the format doesnt change (i.e. individidual cells will expand to fit the data in the cell).
I want to be able to scan through the completed forms and extract the data i.e. Full Study Title, Short Study Title, Study Type etc. into a database.
The issues: 1. Each document will have a different name but will be stored in the same location. 2. What is on page 8, for example, in one document is not necessarity going to be the same on every document (due to expanding cells) 3. Each sector is in a separate table but tables can spread across several pages. 4. Some data is stored in a checkbox format rather than text. 5. I dont want to extract all of the data, only certain sections (at least at this stage).
If I use the word template named "ABC.dot" as attached and write the following piece of code to print off the letters with different appropriate background , it works perfectly fine:
Code: Sub PrintLetters() Application.DisplayAlerts = False Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim r As Long Set cn = New ADODB.Connection
[Code] ....
But if I combine two templates together in one template as attached "Capita.dot" then it doesn't display background picture at all in any of the cases. I am using the same piece of code but the background image is not displaying. The background image shows logos for each letter like For capita letters , the logo will be capita . For Friends Life letters the logo background will be different.
I'd like to export only email addresses separated by ";" to a word document based on a result of a query. Query gets build dynamically in VB behind the form as there are many search criterias. so user can eneter one field or many in the form to build the query. Queries work and i can extract and display the email in a report or another form, but now i'd like to export it to a word document or outlook (but i would prefer word).
Can anyone please give me advice how i should approch this issue.
I'm using ACCESS 2010. I have a form which is having a embedded word document. What I'm trying to do is i want to enable user to format a mail in the embedded word document which will contain rich text and screenshots then with a click of button an outlook mail should open and content of this document should be pasted there. Once user sends this email, I want to save content of embedded document in the database.
The code below allows me to open a publisher document that is already merged to the current record. What I need is to allow the user to open the document according to the group they are reviewing. How to accomplish this?
For example:
IF Group = A1 OR B1 THEN OPEN AB_1.pub IF Group = A2 OR B2 THEN OPEN AB_2.pub IF Group = A3 OR B3 THEN OPEN AB_3.pub
Dim pubApp As Publisher.Application Dim pubDoc As Publisher.Document Set pubApp = New Publisher.Application Set pubDoc = pubApp.Documents.Add.Application.Open("c:Publishe rAB_1.pub) pubDoc.ActiveWindow.Visible = True