Inserting Name Into Word From Access
Jan 28, 2005
Dear All:
I am currently printing a letter from access to word using a command button. So far, so good.
However, I wish to add the person's name on the letter who I am currently viewing on the form. The name of the fields on the form is called "FULL NAME".
Here is the code I am using to print the letter from Access:
Private Sub PrintLetter_Click()
On Error GoTo Err_PrintLetter_Click
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
Set appWord = New Word.Application
' The path/name of the Word document goes here
Set wdDoc = appWord.Documents.Open("C:documents and settingsuserdesktopEXPRESS DIPLOMA LETTER.doc")
wdDoc.PrintOut (False)
wdDoc.Close (False)
appWord.Quit
Set wdDoc = Nothing
Set appWord = Nothing
Exit_PrintLetter_Click:
Exit Sub
Err_PrintLetter_Click:
MsgBox Err.Description
Resume Exit_PrintLetter_Click
End Sub
Any help is appreciated.
Regrds,
Dee
View Replies
ADVERTISEMENT
Feb 17, 2005
I have created a table with ole object types and linked word documents. I am now trying to create a report with the word documents showing up. The problem is that the size of the word document varies, some are half a page some are several pages. When I create the report with the object frame, I can't seem to find a control property to 'can grow'. Is there some way, possibly using VB, to create that feature. I'm thinking the VB way might be to access the embedded file and find out it's size and then size the object frame accordingly. I don't want to make the frame set to the largest document because then there will be blank pages that I don't want in the smaller documents.
Thanks for any help
View 2 Replies
View Related
Sep 23, 2005
Alrght I'm new to access databases so I don't want to make the mistake of assuming I know more than I do, so please help me out if you can. Thanks.
I would like to insert a DataTable that is created from reading an ASPX page's TextBoxes into an Access table or two. So here is my code for the insert.
Code: C#
PHP Code:#region Insert
public bool Insert(ref DataTable InsertData)
{
OleDbConnection myConnection = new OleDbConnection();
OleDbCommand myCommand = new OleDbCommand();
OleDbDataAdapter myAdapter = new OleDbDataAdapter();
OleDbParameter param;
DataTable dt = new DataTable();
StringBuilder SQL = new StringBuilder();
try
{
// Build SQL Statement
SQL.Append("INSERT INTO Driver (");
SQL.Append(" Driver.ID,");
SQL.Append(" Driver.ReservationID,");
SQL.Append(" Driver.PrimaryContact,");
SQL.Append(" Driver.FirstName,");
SQL.Append(" Driver.LastName,");
SQL.Append(" Driver.Address1,");
SQL.Append(" Driver.Address2,");
SQL.Append(" Driver.City,");
SQL.Append(" Driver.State,");
SQL.Append(" Driver.Postal_Code,");
SQL.Append(" Driver.Ownership,");
SQL.Append(" Driver.HomePhone,");
SQL.Append(" Driver.CellPhone,");
SQL.Append(" Driver.AutoInsurance,");
SQL.Append(" Driver.Agent,");
SQL.Append(" Driver.Policy,");
SQL.Append(" Driver.Phone,");
SQL.Append(" Driver.Birthday,");
SQL.Append(" Driver.DriverLicNum,");
SQL.Append(" Driver.DriverLicState,");
SQL.Append(" Driver.DriverLicExpDt,");
SQL.Append(" Driver.DrivingRecord,");
SQL.Append(" Driver.DrivingRecordDetails,");
SQL.Append(" Driver.DriverNumber,");
SQL.Append(" Driver.IsDriver,");
SQL.Append(" Driver.InsertDt,");
SQL.Append(" Driver.ReservationID)");
// Insert Values
SQL.Append(" VALUES(");
SQL.Append(" @ReservationID,");
SQL.Append(" @PrimaryContact,");
SQL.Append(" @FirstName,");
SQL.Append(" @LastName,");
SQL.Append(" @Address1,");
SQL.Append(" @Address2,");
SQL.Append(" @City,");
SQL.Append(" @State,");
SQL.Append(" @Postal_Code,");
SQL.Append(" @Ownership,");
SQL.Append(" @HomePhone,");
SQL.Append(" @CellPhone,");
SQL.Append(" @AutoInsurance,");
SQL.Append(" @Agent,");
SQL.Append(" @Policy,");
SQL.Append(" @Phone,");
SQL.Append(" @Birthday,");
SQL.Append(" @DriverLicNum,");
SQL.Append(" @DriverLicState,");
SQL.Append(" @DriverLicExpDt,");
SQL.Append(" @DrivingRecord,");
SQL.Append(" @DrivingRecordDetails,");
SQL.Append(" @DriverNumber,");
SQL.Append(" @IsDriver,");
SQL.Append(" @InsertDt,");
SQL.Append(" @ReservationID)");
SQL.Append(" )");
// Define Connection
myConnection.ConnectionString = _ConnectionString;
// Build Command
myCommand.Connection = myConnection;
myCommand.CommandType = CommandType.Text;
myCommand.CommandText = SQL.ToString();
// Execute
myConnection.Open();
myAdapter.SelectCommand = myCommand;
myCommand.ExecuteNonQuery();
}
catch( Exception myException )
{
// Raise Error
throw new System.Exception("Exception occurred in: " + MODULE_NAME + ".GetListByRVType(). Exception Error: " + myException.Message, myException);
}
finally
{
// Clean up
myConnection.Close();
myCommand.Dispose();
myAdapter.Dispose();
}
}
#endregion
View 1 Replies
View Related
Dec 28, 2005
I want to update an MS Access table date field with a blank date. How do I go about it? Right now, if the "dateAskFor_Funds" text field is blank, and I try to update the "AskFor_Funds_Date" field in the database, I get an error. That is why I don't do anything.
What expression should I use in the place of
intJunk = 1
in the code caption below.
Private Sub cmdUpdateApplication_Click()
Dim todaysDate
Dim intJunk As Integer
Dim rst As ADODB.Recordset
todaysDate = Date ' MyDate contains the current system date.
Set rst = New ADODB.Recordset
rst.Open "EA_Apps_List", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
…
…
…
If IsNull(Me!dateAskFor_Funds) Or Me!dateAskFor_Funds = "" Then
intJunk = 1
Else
rst!AskFor_Funds_Date = Format(Me!dateAskFor_Funds, "Short Date")
End If
…
…
…
Set rst = Nothing
End Sub
View 1 Replies
View Related
Nov 14, 2006
focking pissed off. i want to add an image to a some forms, the database is all working and that. but when i put a picture in in the design view and then go to view it the whole thing crashs. i nearly lost the whole data base from putting one on the home page, thank fock i had a back up and now ionly have to redo one form as the other one wont open anymore it will just crash every time i try to open it. i have no idea whats going on, i have other images that i put on it before, but i cant put any on now. anyone every encounted this and how do i over come it!
View 2 Replies
View Related
Mar 23, 2005
I am currently using access 97.
I am trying to read from an excel file that has the same format but changes data every day due to reports that I run from a different program. I just export them to this excel file called test.xls
What I want to do is import this data from the excel file and insert it into existing data in my table. I need to this every day.
Currently I cannot get the data to append. I can only insert the data once and cannot get it to append. I tried using macros, but think it would be better to use VB.
Any help you could provide would be great.
Thank You
View 1 Replies
View Related
Apr 15, 2015
I like to store SQL code as a memo field in a table. I then use a form to collect selection criteria from the user, and this is used to create a 'WHERE' clause which is then appended to the stored SQL. This has always worked, but in one recent case the SQL failed. On examination I discovered that although the SQL is correctly stored in the memo field, when Access retrieves the code it inserts a space character in the middle of one of the words, thereby of course creating an invalid SQL string. It's easy to work around it, but why this happens? A bug in Access?
View 1 Replies
View Related
Sep 6, 2012
I have created a tabel in access 2003 which has information about employees and i have to put even their photos as records so i can see them in a report that i have created too.
View 5 Replies
View Related
Jul 27, 2013
I have a specific form, paper version, that I'd like to reproduce in an Access report. This form, which has 34 blank lines in the paper version, is used when people need to borrow some Tools or Equipment on a short period of time.
My report is made up in Access, but, if a person signs for, lets say, three different piece of Equipment, once it is sent to the printer, it prints three lines, which are the equipement signed for and it leave a big empty space before it reach the page footer.
What I need is something that will fill that empty space with blank lines. I found the following on the Net which meets my needs up to a point. What I mean is once it print the last line, it keeps on printing the last line until it meets the total count of 34 lines.
Here what I found on the Net: (note that I have a =count(*) into the Group Header)
Option Compare Database 'Use database order for string comparisons
Option Explicit
Global TotCount As Integer
' Call the SetCount() function from the group header section's
' OnPrint property using the syntax: =SetCount(Report)
[Code] ....
I submitted an attach file (blank_lines.gif) to show you what I end up with.
View 3 Replies
View Related
Oct 31, 2014
In a Access 2003 database, I have an "Inscriptions" (subscription) database with a primary key on 2 fields idPersonnel (employee) and idSession. I have made a form so that user can select a session (in a listbox), then one or more employee (another listbox) and suscribe them to that session by using a button, which, on VBA side, first check that there is enough room on the session (defined by "MaxParticipants" field on "Sessions" table, linked to "Inscriptions" table on idSession), then insert data in "Inscriptions" table
This is working fine in a single-user environnement, but fails if 2 people want to join some employees on the same session at the same time, as I have a confirmation message between check and insertion. Therefore 2 users can select employees, get the confirmation message (at this point both are told there is enough room), resulting in having more people than expected joined to the session. Fortuneatly, if both users try to insert the same employee(s) to that table, one will get a duplicate error, but insertion will be made if employees are different.
On another DB engine, such as SQL server, I would use a stored procedure that would lock the table, do the check and the insertion then unlock the table.
But it does not seem to be possible in MS Access. What are the possibilities in MS Access to prevent a session from having more than maximum number of participants ?
View 1 Replies
View Related
Aug 16, 2012
I'm using Access 2003.
if I create an Import Specification, how do I add an extra field in the middle of the field list? All I can see to do is re-enter all fields from the new field downward.
View 3 Replies
View Related
Jul 9, 2007
Hi,
This is my First post - so please be kind. I'm quite new at coding things and have learnt almost every thing from this forum so far by search old posts but can't find the answer to the below. I know how frustrating it must be to answer the same question over and over again so if this has been answered before please accept my appologies and if you could direct me to the old post I'll pick it up from there.
I have managed to get my DB to output to Excel using the below code:
Set Xl = CreateObject("Excel.Application")
Xl.Visible = True
Xl.Workbooks.Open ("C:TEMPPACLPACL - Blank") ',,True
Xl.range("C8").Value = [Text78]
Xl.range("C9").Value = [tender name]
Xl.range("C10").Value = [Request Number]
Xl.range("F10").Value = [Accepted offer]
Xl.range("C14").Value = [Site Status]
Xl.range("C16").Value = [Accepted offer SPO]
Xl.range("C17").Value = [Type]
Xl.range("C19").Value = [Mpan]
Xl.range("C20").Value = [HH MOP]
Xl.range("C32").Value = [Payment Terms]
Xl.range("C13").Value = [No of sites]
Xl.range("C4").Value = [Text173]
Xl.range("A47").Value = [Additional comments]
I now need to do the same for word;
I have managed:
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Open ("C:TEMPQuatation") ',,True
but I have no idea how to get the info held in field [tender name] in my database into the Ln 5, col 10 in my word document.
I hope this makes sense, any help will be greatly received as I am very new at this and very eager to learn.
View 4 Replies
View Related
May 16, 2005
Okay, m sorry to bring this topic up again!
I have created this command button from tools that output the access report into word file. However, it prints all the record into word file, is there a way that it would print one record or selective record at a time. I mean, lets just say if I am on record 3 after I am done I press the button and I don't want it to output 1 to 3 record just the 3rd one. Is it possible to do it like that or not?
View 14 Replies
View Related
Nov 19, 2005
Hey all! :cool:
I have a question to ask you all. This has been killing :( me I have not been able to find an answer. :confused:
Lets say I have a form open. In this form, there are text boxes that have a persons name, address, an account number, and phone number. This part is the easy part.
Now, what I would like to do is some how when you click on the account number, (it doesn't have to be a link) it will open up another form that shows available Word Documents for only that account number.
Different account numbers will have different Word Documents available to them. When this new form opens, then the user can pick a Word Document that is available to them.
Please help! Your help would mean a lot! :)
View 10 Replies
View Related
Oct 21, 2004
Hi does anybody know if there is a way to import data from a word
template to fields in an access database? any help will be greatly appreciated!
thanks, Treasa
View 4 Replies
View Related
Mar 23, 2005
Is one better than the other to get information into Word Documents
Using access to control word and use mail merge (can I set up the data source for the word document from access...how?)
-or-
Using access, fill in bookmarks created in Word
I have about 30 word documents from a real estate company that they want data from the database merged into the word documents. Too much formating in the word documents to use access report. Any suggestions?
View 3 Replies
View Related
May 4, 2006
I have given up on doing this since I am obviously stupid, but I have a word document that has most things static and about 6 fields that are dynamic. I would like to develop a small GUI in access that the user can input the data into the fields and then click the print cmdbutton that I create and it will open the Word doc, fill the fields that need filled, then print the form.
I tried a mail merge, but I really need this to be a seamless process.
If I use a report in Access, will it hold Word formatting?
These are legal documents that are being printed out.
I wanted to do it with some type of web based app, but my web server is Windows and not Unix so I cannot use CGI.
Any ideas on what I should do?
Thanks in advance for your help.
Robb
View 3 Replies
View Related
Apr 11, 2013
How to match 4 character word or number or combination by identical 4 characters word or number or combination in one word have 10 or 15 characters.
I have to two separate tables (Table A and Table B). Table A has one column (Tag No) and Table B has about 15 columns with one column name Tag No as below
Table A
Table B
Tag No
Tag No
2009
ZZZ-2030-DC
2010
ZZZ-2010-M9P
[code]....
They're both in MS Access.I am trying to match 2 tables - columns (Tag No) with join query, but not success. I want to match 4 characters in Table-A with 4 similar characters in Table-B (Tag No) cell.What query is suitable to compare two tables.
View 8 Replies
View Related
Jul 13, 2005
I have an application on access that export the data to word.
I did a query and the data export to word
my code is:
Dim db, rst
Dim strSQL As String
Set db = CurrentDb
'קישור ופתיחת וורד, והצגתו בצורה מוסרת
Dim objWord 'As Word.Application
'Set word as an application and make it invisible
Set objWord = CreateObject("Word.Application")
objWord.Visible = False 'True is visible
'שם המסמך
objWord.Documents.Add ("C:doc3.doc")
strSQL = Me.strSQL
Set rst = db.OpenRecordset(strSQL)
rst.MoveFirst
Dim strString As String
strString = ""
Do While Not rst.EOF
'ID---------------------------------
strString = strString & rst!nameID & vbTab & vbTab & "|"
'name-------------------------------
If Not IsNull(rst!fName) Then
strString = strString & rst!fName & vbTab & vbTab & "|"
End If
'lName---------------------------------
If Not IsNull(rst!lName) Then
strString = strString & rst!lName & vbTab & vbTab & "|"
End If
rst.MoveNext
strString = strString & vbCrLf
Loop
objWord.ActiveDocument.Bookmarks("aaa").Select
objWord.Selection.Text = strString
objWord.Visible = True
my question:
I want to export the data to a table in word.
I attach the file
(to work good put the file "doc3.doc" to "c:/")
how can I do it?
thanks :)
View 4 Replies
View Related
Nov 7, 2007
Hi,
I'm new to this forum and it's my first post, any help is greatly appreciated.
I have just been given a big project of firstly transferring information we hold in word documents over to Ms Access and then using ASP or .NET I got to make this a searchable, more user friendly web page displaying the information from the database.
I have tried searching on the web but have not found anything that can transfer information from a table in a word document to a table in Ms Access, does anyone know of anything out there that allows this to be done without losing any data in the transfer?
I have tried saving the document as a text file and importing it into Access but it did not transfer the data across correctly.
View 3 Replies
View Related
Nov 9, 2007
Hi there, I am doing a project for my A level computing, and for my mum's financial advising.
I am to assume no knowledge of computing on her part, and so i cannot make it up to the end user to know how to mailmerge.
I was wondering if you could help.
I can have it in a query, form or table form, whichever is best for this, but i need to be able to make a button which exports a record into a MS word mailmerge. This is just to make a simple letterhead. I need a button that says " Write to client ", and once it is clicked it needs to open a letter addressed to them. This is my problem. I have noticed when the data is in a report, there is an export to MS Word button, which is very close to what i want as i could use that and get a good enough mailmerge, but is there a way to run this from a macro or using VB? I did VB last year for my computing project and so i understand a fair amount of it. I want to just make one word document, which will open as mailmerged with the clients data.
Please help if you can, I am sure it is possible as i can see you can mailmerge from access, and there is even a button to do it.... kind of, i just need to be able to make my own.
Thankyou so much for your help.
Steve
( Microsoft Access 2003 )
View 1 Replies
View Related
Nov 14, 2007
I have an Access 2007 Database, containing Dues records for a Membership type application. Each Month I produce a Newsletter vis Publisher 2007, which ends up in PDF format. e-mail Address information is in Outlook 2007, snail mail adress info is in Access.
I want to be able to send an e-mail (Merge ??) to all those who have e-mail, with the Newsletter as an attachment, and with the Dues data in the body of individual e-mails (Merge ??). As the data resides in a number of applications, can someone point me in the direction I should take to achieve this.
Ross
View 1 Replies
View Related
Nov 28, 2006
Howdy folks,
I have a rather large form that I created in Access. It is mainly a travel reimbursement form. It has numerous drop down fields for travelers, dates, etc.
My problem is, how do I email it? I would like for the receiver to see the "printable version". When I try and export it currently, I don't have the ability to send it that way. I can send it as an Excel document, but when I view it, it is about 10 pages wide.
Is there any easy way to make the screen view visible to the receiver?
Any help would be appreciated as my company is opening a satellite office and our administrative assistants will need to get these forms.
Thanks
View 4 Replies
View Related
Sep 20, 2004
I have a word doc which i can open from Access but i need advice on something i would like to try out.
I have a form with a patients name and i can scroll through the table through here(on the form using nav buttons) as well and see other patients information. What i'm trying to do is according to whoever is on the form when they click on the button to open the word doc i want the patients name to appear on the word doc.
I guess it's like a Mail merge but i want the data to be pulled from the form like the patients name and address and i want this information to go onto the Word Doc. Any ideas on how to do this.
Access 2003 and Word 2003.
Thanks in advance,
Skiball
View 4 Replies
View Related
Dec 22, 2004
I use code like the following to build a Word doc from data from multiple
linked tables:
Public Sub Build_Word_Doc()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Set wrdApp = New Word.Application
Set wrdDoc = New Word.Document
wrdDoc.Activate
wrdDoc.Select
....
{code to build and save doc}
End Sub
If the user does NOT have an instance of Word open when the code runs,
everything processes as desired. If, however, they had Word open when
this code executes, they receive an error and there is a "phantom"
WINWORD.EXE left in Task Manager.
Is there a good way to check for the presence of an active Word doc before
running this code, or any other suggestions to avoid the situation I described?
Any help would be appreciated, 'cause my users look at me cross-eyed when
I tell them they have to close all Word docs before using my application.
Thanks!
View 2 Replies
View Related
Feb 24, 2005
Hi folks, can anyone assist me with my dillema, I am trying to merge records selected by the user from my Access database to word. Does anyone know of any VB code that I could use? Steve
View 2 Replies
View Related