Modules & VBA :: Mailmerge Current Record And Save As New Document
May 25, 2014
I'm looking to add a button to my Customers form which will mailmerge the current record to a Word template and then save the Word doc as a new file (Ideally the customer's name).
I've looked at the Super Easy Mailmerge but I can't work out how to implement it without all of the variables (selecting documents etc.).
The files will all be saved to one location (C:CustomersExports) and this won't change.
This is also the location of the mailmerge template (C:CustomersExportsTemplate.docx)
View Replies
ADVERTISEMENT
Aug 5, 2013
I am having the strangest results with my automated mailmerge. Basically it does work, but not all the time. The basic idea is to allow the user to dynamically create a query that produces a result list which fills a temporary table. The use then selects a prebuilt merge template and merge is executed against the temp table. The merge template are of the .doc type, but sme have been converted to .docx; the .doc files tend to work most often, but all of the will eventually get a Table is locked message... However if I run in test mode with code breaks and manually step through the process it always works... here is the heart of the code ...
Err_Pos = 10
Code:
DoCmd.SetWarnings False
' if tmp tbl left over from last run kill it
DoCmd.RunSQL "Drop table Word_Merge_Tmp_TBL"
Err_Pos = 12
[Code].....
There are many error cases in the error catch routine. That I have managed to make Access stop hanging when word has a problem or the table is locked. But I can't get the table to be free consistantly and why does it always work when I manually step through the code.
View 4 Replies
View Related
Jan 17, 2014
I'm using: DoCmd.OutputTo acOutputForm, "Frm_EL_PL_Bulk_Send", acFormatPDF, outputFileName1...To save a form as a PDF. The issue is, it saves all the records in that set in continuous form, and I'm trying to get it to only save the record its on.
View 3 Replies
View Related
Dec 4, 2013
I have 2 form, form1 and form 2 (picture attached)
In Form 1
(main form) there are "reference" field with key pressed event
then call form 2 (list of reference that user can choose)
In form 2
the problem is, when "enter" key pressed (keypress event), selection will move to next record
so the data that transferred to form 1 is wrong (next record)
The question is : how to save current record in form 2 before enter and send the data to form 1
View 3 Replies
View Related
Feb 12, 2014
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.
I am using Access 2010.
View 2 Replies
View Related
May 10, 2014
I have been working on a bound form that I can't seem to get working.
It records deliveries and what I am trying to achieve is after the form has been filled in the user will click a save button where the record will be added to the table and a record automatically printed via a report and emailed to the shop manager, but i keep getting the error "No Current record" no matter what way I try to do it, I have tried using to run the report. Is the best way for me to accomplish this o change it to an unbound for and run an insert query on click?
I have attached a copy of what I have been working on : DatabaseDelivery.accdb
View 2 Replies
View Related
Jan 12, 2015
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
[Code]...
View 8 Replies
View Related
Nov 29, 2004
Hi
I have a form (Quotation) and i would like when i press a command box to save it as a word document.
I tried that with a command box and with a macro using OutputTo Action.
I can save the Form But i can not have a proper understandable format.
How this is possible?
My aim is to save it as .rtf for example, and attached to the customer mail.
Please advice me.
View 4 Replies
View Related
Sep 12, 2014
I work in a school where teachers have to archive their assessments and other documents monthly. Currently they email them to a set email address but I was wondering if it would be possible for me to make something with access whereby they can do this. I'd like to make a form where they selected their name and then attached a file, this file would then be saved in an area I would have assigned that persons name to, does this make sense? I want it to be very simple so just a name section from a dropdown then a file upload section and done.
View 11 Replies
View Related
Aug 19, 2013
I have two forms both with separate tables
(1) Register and
(2) Payments.
One of the common denominators between them is the URN which is auto-populated as it is an auto number field. My issue is that when I want to add a new record to the payments table using the forms (I can get to the payments form via the register form), I want to be able to identify the record that I am currently viewing within the register and auto populate the URN field with the same number. This is what I have done so far,
Option Compare Database
Option Explicit
Private Sub AttachPaymentDetails()
Call PerformInsert("tblFinancialBudget", "frmFinancialBudget")
End Sub
[code]....
View 5 Replies
View Related
May 6, 2015
I'm trying to make a form that shows what the last record was next to the empty space where you enter a new record.
This is so the user knows that what they are entering is roughly in line with what has come before.
So for example if I was recording temperature every May, I would like a form that has a field called temperature and next to that field I would like to see last year's temperature.
Records:
Date | Temp
2014 | 20.5
2013 | 18.5
2012 | 19.0
2011 | 22.7
2010 | 15.2
So when I enter the record for 2015 I have a box that says: Temp and next to that box is "Last year was 20.5" or something like that.
View 2 Replies
View Related
Nov 25, 2014
I have a database of film events, for which i have to do posters.
With the click of a button on a form, access opens word and puts all the fields in, including a field called [photo], which is the name of the image stored outside of the database.
Is there a way of getting that image into the word Document with all the other fields? Or have I just wasted an afternoon....
View 2 Replies
View Related
Feb 9, 2015
I need to save a new record from a form before it gets printed, the vba code behind the print button at the minute just opens the report and inserts the record in it. I need to put something in before that to save the record when the button is clicked.
The form in question is frmPlaceOrderFinal and I'm referring to the print button (command17). I've attached my system as well as an image for reference. The code that is currently behind the button:
Code:
Private Sub Command17_Click()
Dim strDocName As String
Dim strWhere As String
strDocName = "rptFinalInvoice"
strWhere = "[InvoiceID]=" & Me!InvoiceID
DoCmd.OpenReport strDocName, acPreview, , strWhere
End Sub
I need to save the record before it is opened in the report.
View 2 Replies
View Related
Mar 27, 2015
I wanted to get the autonumber ID before a record was saved to the table. My fields are on a form that is linked to the table. Maybe my solution is not the most elegant but it seems to work.
I messed around and came up with this solution: it creates the next record and captures the autoID then increments it and creates the record we will actually use. Since we know the current autoID we know 100% the next will be the current+1
Code:
' Code by Witchcraftz
' Button event to add new record
Private Sub cmdAddRecord_Click()
Dim strID As String
[code]...
View 2 Replies
View Related
Dec 5, 2014
i want to get the id of a new record in a msgbox.this is my code
Code:
Dim MSG As Integer
Dim ExistentID As Long
ExistentID = Nz(DLookup("P_ID", "tbl_Personal_Information", "Full_Name = Forms!frm_New_Person!F_N"), 0)
If ExistentID > 0 Then
[code]....
my problem is with MSG2 when i click save it will save the info but it will not show the message MSG2.if i remove this {" & [P_ID] & "} from the MSG2 it will open.if it's existed she don't open and if i press again it will show the MSG1
View 8 Replies
View Related
May 24, 2014
Trying to make this code work, don't know how to filter as it prints identical all reports.
Private Sub cmdExportPDF_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim MyPath As String
MyPath = "C:Reports"
If Len(Dir(MyPath, vbDirectory)) < 1 Then
MkDir (MyPath)
[code]....
View 14 Replies
View Related
Jun 18, 2014
I have a list box that my client goes through with vbKeyDown and vbKeyUp. When he finds the correct record he wants to do vbKeyReturn and capture the checktype code and description and have them placed in a check which is another form that is open. The following code does not work:
Private Sub List3_KeyDown(KeyCode as integer, Shift as Integer)
If KeyCode = vbKeyReturn Then
Forms!frmChecks![TRA{CODING =
Me.CurrentRecord.Column(1)
Forms!frmChecks![TRA:CODEDESC] =
Me.CurrentRecord.column(2)
DoCmd.Close adForm, "frmCheckType", acSaveNo
KeyCode = 0
End If
View 2 Replies
View Related
Nov 5, 2014
I am adding new record into subform via recordsetclone method. The problem is that record is added but on save it does not appear in the table. If add this record manual using subform everything works. When record added manually update of the record works fine.
C
'Add Wastage value to flooring area section
Private Sub Wastage_AfterUpdate()
Dim rsFlArea As DAO.Recordset
Dim Wastage As Double
Dim Item As String
Set rsFlArea = Me.OrderFloorAreaEdit.Form.RecordsetClone
[Code] .....
View 6 Replies
View Related
Jun 3, 2015
I have a form with a subform. In the form's On Current event I have the subform's visible property set to false. There is a button that when clicked sets the subform's visible property to true. I want the subform to go to the first control in a new record which is a combo box. the subform is a multiple items form. I have tried the GoToControl in the subforms OnCurrent event, but it is not working. I get an error saying the database cant find a third form.
View 4 Replies
View Related
Aug 4, 2013
I have a DAO.recordset called "rsSQLIn". This comes from a csv file by:
Code:
strSql = "SELECT * " _
& "FROM [Text;Database=" _
& strFolder _
[Code]....
While the validation runs a boolean keeps track of validated input and errored input.
After validation the validated input is dumped in the table.
Now what I want is de saving the errored record from "rsSQLIn" to be copied to a new .csv file.
The problem I have is that I cant seem to get the current record from the recordset "rsSQLIn". How do I reference this? I need the complete set of 24 fields being the same within "rsSQLIn"
View 3 Replies
View Related
Sep 18, 2014
I get this error when I delete more than one record consecutively.
Here is my delete code;
Private Sub Komut98_Click()
Dim blnLast As Boolean
'MsgBox call must return the value in order to be checked.
'If user says no then cancelling is not required. It is only required
' that the deletion command is not invoked.
[Code] ....
View 5 Replies
View Related
Nov 5, 2013
i want to crate a continuous form where i can add a button to export all of the attachments in that current record, i can create a folder and name it same as the selected record but how I can export all of the attachments in that record
Code:
Dim strUserName As String
Dim Location As String
strUserName = Environ("UserName")
Location = "C:Documents and Settings" & strUserName & "Desktop" & Me.ID
If Dir(Location, vbDirectory) = "" Then
MkDir Location
View 2 Replies
View Related
Aug 7, 2015
Is there a way to print the current record from a dao.recordset?
This is an exercise to compare data content.
I have a table with 30 fields and thousands of rows (rs1).
I'm comparing it with a copy of the same table (rs2) that has the same number of fields and the same rows and almost the same content.
I can loop through the recordsets and get the cursor to stop on a field whose values don't match, lets say on row #x
and the programmed message will say something like:
"ROW: 699 Field: [RequestStatus] rs1.VALUE: Closed, DOES NOT MATCH rs2.Value: VOID, in the comparison recordset"Then I'd like to print the entire Row, Row #699.
I thought I could use rs1.getrows but I'm not sure how to make that work.
View 4 Replies
View Related
Sep 11, 2013
I am receiving the No Current Record message, but have been unable to determine the code that generates it. The database is a system that creates tasks and assigns them to users. In the header section of the Tasks form are several controls they can use to select Active or Completed tasks, refresh the data, sort by columns, etc. There are also three other forms (not subforms) that lay on top of the Tasks form to provide additional detail about the current task.
If they "complete" all their active tasks and click Refresh, all the tasks disappear, as they should, and everything works fine. If they then try to close the form, or click any control in the Tasks header, the No Current Record message pops up. I've put debug stops in every conceivable location, but the message appears to occur before any code is activated.
I did find that I can make the message not occur by commenting out the code that synchronizes one of the associated forms (Notes), but I still don't know what is triggering the message. Debug stops in Notes yield no results either, and clicking a control in the header of Tasks shouldn't affect Notes.
How to find out what's triggering the message?
View 5 Replies
View Related
Jul 13, 2014
Its been a few years since I used Access, and despite searches I cant find what I'm looking for. I have a VERY simple form, with only one record on it - "address". I have some print buttons which will print that address to different size labels, and some navigation items, but only one actual record - which is "address" (in the table, this address is a MEMO)
I would like to have a command button that when clicked copies the current record, and opens an existing Excel Spreadsheet and pastes that address into (for example) cell C8
Can it be done easily? Is there a DoCmd.TransferSpreadsheet kind of secnario that works with current record only?
View 8 Replies
View Related
May 11, 2014
I was creating a program using ms access. consist of 2 table of database called employee and userlevel.. in employee table have ID, name, username, password,userlevel, and others related employee profile.. and in userlevel table, it consist of admin level and normal user level.. Userlevel table allow to differenciate admin and normal user(employee) .. in my program each employee having their own loginID and pass to access their own data.. the problem with my program now is displaying the data that belong to the logged in employee. its mean that it only show the data that owned by currently user that logged in..
View 7 Replies
View Related