Form Data To MS Word & Protecting The Form Template
Dec 18, 2006
Thanks to some of the threads here, I have managed to automate inputting form data from a record into bookmarks in a word document template (a letter). What I am trying to do is to lock the letter allowing modification only to the form fields in that template. If the original template is locked (allowing entry only in the fields), the data does not flow through. So I was trying to accomplish this through the "ProtectedForForms" property. However, it does not work. The letter gets locked before the information flows through. Here's the code I am trying to use (borrowed from one of the users here):
Private Sub cmd_letWarn_Click()
' Check for empty fields and unsaved record.
If IsNull(occupant) Then
MsgBox "Occupant Name cannot be empty"
Me.occupant.SetFocus
Exit Sub
End If
If IsNull(propad_no) Then
MsgBox "Building Number cannot be empty"
Me.propad_no.SetFocus
Exit Sub
End If
If IsNull(prop_ZIP) Then
MsgBox "ZIP Code cannot be empty"
Me.prop_ZIP.SetFocus
Exit Sub
End If
If Me.Dirty Then
If MsgBox("Record has not been saved. " & Chr(13) & _
"Do you want to save it?", vbInformation + vbOKCancel) = vbOK Then
DoCmd.RunCommand acCmdSaveRecord
Else
Exit Sub
End If
End If
' Create a Word document from template.
Dim WordApp As Word.Application
Dim strTemplateLocation As String
' Specify location of template
strTemplateLocation = "T:PlanningPlanningEnforcementLogsuppfiles emp warn.dot"
On Error Resume Next
Set WordApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set WordApp = CreateObject("Word.Application")
End If
On Error GoTo ErrHandler
I am creating a db for my work place that records incidents that take place. I am a novice at Access but I have made different tables, queries, forms and reports and they all work.
I was wondering if there was a way to extract data that a user enters into a form and then use that to populate a word template *without* coding using VBA? I am really a beginner and not confident with VBA at all. I have read the forum and that seems to be an option (but would rather something else if possible!)
I have a form with fields that contain the address/postcode etc of the person in question, and I also have a template letter that needs to have said persons address/postcode etc at the sending stage after a button is clicked.
I'm doing a project for my work. I created a few reports in Access. Some of these reports are simple graphic bars. How can I insert these reports into a word document template?
I'm currently working on a project within access which will allow users to select/input information in a form which will then save to the database.
What I need is to create a button on the form which will allow you to convert the data collected from the form to a custom text file template.
(Or maybe the last row added to the database. - although this may cause errors. Example: the form information doesn't save which will in turn create a text file with the data collected from the previous job)
The custom text file template should have a sentence description followed by the value recorded from the form.
Example:
1 configuration type: (data from form)
2 model type: (data from form)
3 Poc: (data from form)
And so on.
So in summary - I would be to use the form to collect the desired information which will save to the database.
Once actioned, a custom text file should be populated with the collected information (with specific data placement as per the example above)....
Hi I have a database and I want to basically use table fields to load into a Word template and I want this done via code, i.e a button....any help very much appreciated!
I am using the follow code to import data from a Word form into my MS Access 2010 DB:
Code: Set dbs = CurrentDb Set rst = dbs.OpenRecordset("tmpSIRs", dbOpenDynaset) With rst .AddNew
[code]...
On the Word Form, these two fields are drop-downs with three options: blank, No, and Yes. If the users leaves them blank, then Access ignores them--which is what I want. However, if the user says yes or no, Access puts a "-1" in the database. Both the Word form and Access field are text.
i have a form and was wondering if it was possible to take some of the fields and drop them into a template word document from inside access. so as to create a button that when clicked opens up the template and transferes the wanted form data.
any idears how to automate this process would be greatly appreciated
I searched the archive and didn't find quite what I was looking for, so..
I have an Excel 2003 spreadsheet work-in-progress being used as a template (developed by others) to prepare project cost estimates in a complex regulatory environment. We are 'modelling on the fly' for a number of projects until we are comfortable with the estimate model, after which time I intend to incorporate our 'stable' estimate methodology into Access. Meanwhile, I am 'stuck' with the Excel spreadsheet.
I have a project tracking database (Access 2003), and I want to be able to track my estimates. I do NOT want to embed my spreadsheets into the db, just a filelink. There can be more than 1 estimate per project.
Ideally, the user should be able to define a project in the Access db (or select one already defined) and click a 'make estimate' button, which would generate a new Excel file in a predefined directory (based on the present version of the .xlt file), give it an appropriate filename (based on the Access ProjectID and estimate sequence number for that project if there were others already), open up that workbook in Excel, and then autopopulate some cells based on information showing on the original form in Access!
A separate button for 'Open existing estimate' will eventually be required, but I think I could do that if I can get someone to walk me through the steps required above.
I am somewhat familiar with vba in Access, but am an absolute rookie when it comes to excel.
Edit: I left out that I would also add an appropriate record to a table like tblEstimate which would contain the link(s) to the estimate(s). This table will obviously contain a FK to tblProject
I've got a button on a form that opens another form - nothing unusual, but it would be preferable if this second form was password protected i.e. the user clicks the button to open the form and is immediately prompted to enter a password. I've looked at user-level security wizards but that confused me even more.
The database is networked and is used by 25+ people by the way.
Hi all, Not sure if this is in the right section but heres my question.
How can i gett a button to open a word document and put in specific information. for example. to send a client a letter, the button would open a word doc with the specfic client data in it.
Also a button to start a mail merge with all client records held on the db.
I'm using the below to merge an access form into a word template (it's a starter for 10).
That works fine. What I need to do is save the word template as HTML so I can then upload it to my website.
Dim wordApp1 As Word.Application Dim docPath1 As String Dim fileName1 As String Dim PageName As String PageName = Forms!Frm_Page_Create![Page] docPath1 = Application.CurrentProject.Path & "Merges"
For keeping record of provient fund, I have made a access/(or excel) database with many fields like ID, Name,contribution for months eg March, April,..to..,Feb,etc.It contains 50 records.
Now I have to print the provident fund statements of my 50 friends. This statement consists of some text language and some data(It is a word form letter document).The statement also shows some data which has to be calculated from the data of database eg grand total, cumulative total, interests etc.
Now I want to print the statement for all or selected no of people. What I want is to make the statement proforma in another excel sheet and then merge and print the statements for selected no of persons eg for ID 1 to 20, 50 to 70 etc. I do not want to make statement in MS word and do not want to merge it there, but I want to do it in excel just as we do in MS word mail merge.
Pl help me how can I do it in access/Excel? Can i calculate in word or should I calculate before hand in access before merging data?
copying all the contents/text from word document and pasted that in the Memo Field, I have a Recruitment database where I have 02 fields on is CV Path (Text Field) that stores the CV Path (Word Document Path) and another text box content (Memo Field) where I would like to copy all the data from the word document to the Content text box (Memo) field.
I have put a Command button on the form...the code to "Copy the content/text" from [CV Path] word document and add it to the "Memo" field.
I am working in Access 2013.I'll be performing a series of inspections at a number of intersections for a small community. The data being captured is consistent from site to site and lends itself to a database application, and what I would like to do is the following:Use forms to capture the data.Generate a report to preview the output for a single record. I may ultimately decide to set the report datasource to a query.Attach a macro to a button that exports fields from that record to a template based in MS Word.The first two bullet items I can handle with my limited Access capability. Each file has to be individually reviewed and saved, and each file will ultimately contain an electronic signature.
I have my word template set up such that some data is copied from the open form into the document and some data is taken from a table which is created from a query based on the content of the form (the record number). This works well HOWEVER (there's always a however isn't there :rolleyes: ) where two users click on the button at exactly the same time or within a very short space of time the query only runs once and either the database crashes (bad) or the document is created for the second person with the wrong data (very bad).
How can I make it so that only one person can run the query at a time (ideally build in a delay in processing so that the query will run for them when the first person has finished...failing that a message to say please try again later)? They will always be working with a different record.
I'm a bit stuck as to what to search for in the forum for an answer to this so haven't really searched.....sorry :(
I have the following VBA code that auto populates a word template:
Private Sub Command24_Click() On Error GoTo ErrorHandler: ErrorHandler:
[Code].....
The code executes flawlessy but there are three values that are based off check boxes set as YES/NO (EMPLOYEDATREGISTRATION, EMPLOYED and FRINGEBENEFITS). These values show up as -1 for YES and 0 for NO.
Is there anyway to add code to mine that would allow me to change these values before they are sent to the Word template?
I was thinking today if it is possible to fill Access reports based on a specific Word template? I don't want to populate a Word file with Access data as users of my app might not all have Word. Or is there another solution using a WYSIWYG editor where users can format everything according to their needs? That would be fantastic.
I am trying to open a word document with corresponding data filled from the text field of a form. I managed to get the word document but I don't know how to give a variable in word document.
I downloaded a time clock template the other day and Ive been tweaking it for a while now. There is one thing I can't figure out:
There is a form called frmClockOut, which is a subform on frmClockIn.
This subform appears after the ClockIn button is clicked. The problem is, if I close the database for any reason, and leave someone clocked in, the ClockOut button does not appear until after you re-click ClockIn.
The developer has put in a safety so that it does not "double-punch" someone in or out so its ok there. Id just rather keep this subform open or always showing and cannot figure out where its done on here.
In my DB I have a query that I need to create a static webpage from, now in excel I can do the record button and bingo, but access is a lot more confusing.
I have a template named doc_tplt.html that when I do the export from the query it creates the webpage using this template.
I want to have a form with a selection of command buttons on it to export to html using the template for various queries and tables.
What is the VBA code to export the query (qry_docs) and apply the template (doc_tplt.html) and save to the same directory as the DB itself.