Now that I have this code working on my access 2003 version. Can anyone please show me how to alter it so that it run on a office 97 version?
I think it is something to do with 'WORD OBJ'?
Many thanks, Steve
Private Sub cboReport_Change()
On Error GoTo Err_Handler
If Nz(Len(Me.cboReport), 0) = 0 Then
MsgBox "You must select a correspondance letter"
Else
Dim WordObj As Word.Document
Dim strPathtoYourDocument
strPathtoYourDocument = "D:DataFrm_" & Me.cboReport & ".doc"
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryMailMerge"
DoCmd.SetWarnings True
Set WordObj = GetObject(strPathtoYourDocument)
WordObj.MailMerge.Destination = wdSendToNewDocument
WordObj.MailMerge.Execute
WordObj.Close wdDoNotSaveChanges
WordObj.Application.Quit
Set WordObj = Nothing
Exit Sub
Err_Handler:
Beep
MsgBox "You have cancelled this operation."
Works great, but when I hit the number "3", (3 times in row) it will let me into the form. I want it to not let me in IF I don't know the password.
Where did I go wrong?
Private Sub Form_Load() Dim pw As Variant
If InputBox("What is the password?", "Password") = "1" Then Else MsgBox "Invalid Password", vbCritical, "Sorry Charlie" DoCmd.Close If InputBox("What is the password?", "Password") = "2" Then Else MsgBox "Invalid Password", vbCritical, "Sorry Charlie" DoCmd.Close End If End If
I protect my code from people being able to read it by setting a password on the code from Tools > Properties, selecting the Protection tab and entering a password, and clicking "Lock Project"
Is there a way to write code that will remove that Lock Project check and check it back on?
I've looked through the Application.SetOption command and it doesn't seem to be one of the choices. It would be very helpful if someone knew how to do this.
I have 1 a table named Products and i'm using group by, i have a field named etc witch contains free text and i want to merge all data from that field to 1 filed called all_etc (from all records i mean)
id name code qua etc Group By Group By Group By Sum ??????????? 1 prod_1 001 1 etc_1 1 prod_1 001 5 etc_2 1 prod_1 001 1 etc_3 1 prod_1 001 1 etc_4 1 prod_1 001 1 etc_5
When applicable, I have letters in Word already set up to show the cc: information at the bottom. However, Management needs a statement added to the bottom of the letters that ONLY show the cc:
I am having a slight problem trying to figure out how to make this statement show up only on certain letters.
Does anyone have any thoughts that could help me? I'd appreciate it very much.
I am totally new to Access and this is my first database.
I have a database for volunteers in which table A is basically a calendar and table B a list of volunteers with their details.
What I want to do is construct a report that will allow me to produce a mail merge letter such that:
1. One volunteer, with his/her information, is selected from table B and inserted into a mail merge letter. (The volunteer selected will change from letter to letter).
2 Certain days are selected from table A and added to the mail merge letter. This information will be the same in all letter.
I have posted a separate thread asking how I can make the selection of days in (2) above so you can assume that I know how to make the selection within table B.
How do I proceed?
If anyone knows a good example of this type of report then i will be extremely grateful.
I have 3 tables: tbl_1, tbl_2, tbl_3 All 3 have the same 3 columns: name, email, code
Can I write some queries or a code or something that can create one "tbl_MASTER" with the same 3 columns?
Ex: tbl_1 - 3 records tbl_2 - 7 records tbl_3 - 21 records
tbl_MASTER - 31 records. Now the information in the other 3 tables changes everyday so I want it to all be automatic, I dont want to execute 3 different queries or anything like that. Is this doable. Thanks.
I have a table that has, among others, Address1, Address2 and Address3. If Address2 andor Address3 are empty for a particular record, I get blank lines in the Word doc. How do I prevent these blank lines?
Hi, i have set up a mail merge between a query and a word document. My system is a system that processes transactions from an online cd shop. I have made it so that each cd that is bought by each customer is a different transaction in a transaction table, and each transaction is given an order number to group them. How do i get the mail merge to show all the transactions in an order on the invoice in my word doc because at the moment, even if i add two of the title name fields, they both show the same transaction.
Im having a problem getting this code to work. It is meant to fire up Word (which it does), open up a new doc based on the template (which it also does) and then populate a field in the doc with data from the query table (which it doesn't).
I've put the fields in the Word doc via firstly, defining them as Custom Document Properties in the File, Properties box, and then as "{ DOCPROPERTY "<fieldname>" *MERGEFORMAT }" codes in the text.
The field in the Word doc is type 'text' and the field in Access is type 'text', so I am stumped by the "Type Mismatch" error it gives when attempting to get/open the recordset. It hasnt even got to transferring the values across to the doc.?
Ive not done this before (Access newbie) and even found creating the custom fields in Word not as straighforward as I expected!
Please can someone help?
Private Sub butDocPreview_Click()
Dim dbs As Database Dim objDocs As Object Dim objWord As Object Dim prps As Object Dim rst As Recordset Dim strClient As String Dim strAccountManager As String
On Error Resume Next Set objWord = GetObject(, "Word.Application") If Err.Number = 429 Then 'Word is not running; creating a Word object Set objWord = CreateObject("Word.Application") Err.Clear End If
On Error GoTo cmdWord_ClickError DoCmd.SetWarnings False 'Open query.. DoCmd.OpenQuery "qryClientDocHdr_Export" intCount = DCount("*", "tmpClientDocHdr") Debug.Print "Number of Text items: " & intCount ' Check that there is at least one line.. If intCount < 1 Then MsgBox "No text to process; cancelling" Exit Sub End If
Set dbs = CurrentDb '==stops here with "Type Mismatch" error== Set rst = dbs.OpenRecordset("tmpClientDocHdr", dbOpenDynaset) With rst strClient = Nz(![Client]) strAccountManager = Nz(![AccountManager]) End With rst.Close ... ... ...
I have a database with two tables, Buyer and Products, with one-to-many relationship. The key of Buyer is an autonumber ID, which is the foreign key to table Products.
The problem is that i have two copies of this database with different records (with ID starting from 1 to each one) and i want to merge the databases into one.
Any ideas how to do this without lose the connection of the records?
How do I merge these two datbases? I have downloaded them from Microsoft online templates, here http://office.microsoft.com/en-gb/templates/TC010178391033.aspx?CategoryID=CT101426031033&av=ZAC000 and here http://office.microsoft.com/en-gb/templates/TC010185481033.aspx?CategoryID=CT101426031033&av=ZAC000 and I want to have the two databases as one so that there will be a fourth tab on the cintact management database with the order form on? I want to be able to link the two so I can have all the customers details and orders together and print off reports. I really have not dealt with Access before so I really dont have a clue. Any help would be truly appreciated. I am sure it is easy but I just cant work out how to do it.
Anyone have a good online resource for generating a single thank you letter, eg. by way of a mail merge using MS Access 2003 with Word 2003? I know you need to write a form letter first with various fields that conincide with fields in Access. I have done this many times with large mailings but need to know how to write individual letters for thank yous, invites, etc.
I need to merge two Access DBs but I need to know if it is even possible before I start learning how to do it. It is not easy for me to express the problem but here goes:
DB A: -Flat Table with numbered indexes -will use a unique field as my index for the merge (not the primary key)
DB B: -The destination -One to Many relation (table 1 to table 2) -primary key not numbered field (I think) -will match primary key to the unique field in DB A -a few fields from DB A will be appended to table 2
....................DB B Table1----------------Table2 ******---------------************ *-----*-one to many-*-------------* ******---------------*-------------* -----------------------*-------------*----append----------DB A -----------------------************...<<<<<<<......*********** --------------------------------------------------------*-----------* --------------------------------------------------------***********
I have a very simple question which is anoying me already for a very long time. I have two tables both with a key field, a common field and a table specic field. Like :
I have database A & database B, which is a copy of the first. I have made some changes to database B but need to merge one table back into the original database.
I have a table with the following fields for each record: StudentID CsrID Average FinalExam
For most StudentID/CsrID there are two records, one with the Average and a null FinalExam, one with the FinalExam and a null Average. If there is no FinalExam, no record is generated.
How can I merge the records so that I will have only one record for each StudentID/CsrID that includes both the Average and the FinalExam?
I want to create an expression in a query, which is a combination of one or more fields in a table. e.g., Concatenate function in excel. Is there any such function in access. Please help me.
I am editing the design of a census, and I would like to be able to mail merge form the query directly to a new document in microsoft word...so you can create the document and then merge to it, is this possible using a macro or VBA? I can't work out how to do it!! The query name is "List of Families" and I want to merge to a blank document, so I can create a different document everytime...as the letters aren't circulars!
I have a table with records in like the follwowing examples.
Record 1 ID - 1 AccountID - 123 Name - Mr Smith Address - 38 The Close PetName - Tilly
Record 2 ID - 2 AccountID - 123 Name - Mr Smith Address - 38 The Close PetName - Chloe
Record 3 ID - 3 AccountID - 124 Name - Mr Jones Address - 49 The Avenue PetName - Francis
I would like to be able to run an update query that would merge the records with the same Account ID by PetName so that my table would now look like this
Record 1 ID - 1 AccountID - 123 Name - Mr Smith Address - 38 The Close PetName - Tilly & Chloe
Record 3 ID - 3 AccountID - 124 Name - Mr Jones Address - 49 The Avenue PetName - Francis
So record 2 would have been removed but the Pet that belongs merged with an & into record 1.
I just finished creating an access file. Here are the contents:
TABLE Customers - Includes email, contact name, company name, address, zip, city, etc. TABLE Materials - Includes company name and material. Each record is listed as a company with a material requested. Companies are listed multiple times, as they are unique records because the materials are different.
I have Company name set up as the primary key, and it sets the relationship between the two tables
I have a Report fully working. The first page is a letter with the customers' mailing info at the top. The second page is a list of all the materials this company ordered for the 2004 year.
The report pulls from a QUERY that comes from the customers table and the materials table.
This report is hundreds of pages long, as we have multiple customers who order many materials each.
My question is "How do I mail merge this report out to the customer?" I do not want to send each customer the whole 500 page report, but only their specific record that they should receive.
I do not care if I have to merge with Word, Outlook, etc. I just dont want to have to send these out individually.