Record Cant Contain The Same Word, How?
Jan 4, 2007
Im new here so Hi!
My name is jitze de wilde. Im from the netherlands. Im 21. I work at www.visualmedia.nl
On my current asignment im collecting data on all the business in the local area.
I aquired alot of information and there are bount to be duplicates.
now my question. Is there a way in Access to fish out duplicate items or records (dont know the name)?
example:
I enter the following data.
Kreeft Holding B.V.
Agarica B.V.
S.I.T. Controls B.V.
Robatechniek B.V.
Mannak Techniek B.V.
Kip Caravans B.V.
Van Venrooy B.V.
Robatechniek B.V.
In the list Robatechniek B.V. exists twice. Is there a way access will prompt a message "item already exists" or something like that?
View Replies
ADVERTISEMENT
Jun 8, 2007
OK - bit of a newbie here & maybe this question has been asked a thousand times but i can't find any answers that cover this question properly.
Basically i am writing an access database that stores contract information, contact details, orders etc etc. I want to take the Order Number field, along with the Client Name & Address etc and post it into a Word Mail Merge type document, then save that file as ordernumber.doc after checking to see whether it already exists.
I have successfully managed to send the information into word in a mail merge document & get it to save the file using the ordernumber.doc format, however it is saving it to mydocuments folder and i want it in a subfolder called orders (that does exist). It is also not checking to see if that file already exist and overwrites it if it does.
I want to change the path to where the file is being saved, check whether it exists already, then ask me whether i want to overwrite it or save as something else.
Any help would be most appreciated. BTW I am using Word & Access 2003.
*****THIS IS THE CODE I AM USING*****
Private Sub NewEternit_Click()
On Error GoTo NewEternit_Err
Dim objWord As Object
'Start Microsoft Word.
Set objWord = CreateObject("Word.Application")
With objWord
'Make the application visible.
.Visible = True
'Open the document.
.Documents.Add ("\shentcDocuments and SettingsJohn.SHENTMy DocumentsTemplatesEternit Order Merge.dot")
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("orderno").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!ContractNo) & "/" & (Forms!frmOrderDetails!OrderNo))
.ActiveDocument.Bookmarks("Date").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!Date))
If Me.chkDeliverYard = False Then
.ActiveDocument.Bookmarks("ClientName").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!ClientName))
.ActiveDocument.Bookmarks("SiteReference").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!SiteReference))
.ActiveDocument.Bookmarks("SiteAddress1").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!SiteAddress1))
.ActiveDocument.Bookmarks("SiteAddress2").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!SiteAddress2))
.ActiveDocument.Bookmarks("SiteAddress3").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!SiteAddress3))
.ActiveDocument.Bookmarks("Town").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!Town))
.ActiveDocument.Bookmarks("City").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!City))
.ActiveDocument.Bookmarks("Postcode").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!Postcode))
Else
.ActiveDocument.Bookmarks("ClientName").Select
.Selection.Text = "OUR YARD"
.ActiveDocument.Bookmarks("SiteReference").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("SiteAddress1").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("SiteAddress2").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("SiteAddress3").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("Town").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("City").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("Postcode").Select
.Selection.Text = ""
End If
'Print the document in the foreground so Microsoft Word will not close
'until the document finishes printing.
'objWord.ActiveDocument.PrintOut Background:=False
' Save the file using orderno field
Dim FName As String
FName = Forms!frmOrderDetails!OrderNo & ".doc"
'Quit Microsoft Word and release the object variable.
'objWord.Quit
'Set objWord = Nothing
End With
Exit Sub
**** END OF CODE****
View 4 Replies
View Related
Jan 25, 2008
I was wondering if there is an awesome way out there somewhere to take a record and export it into a word document, like a template and have the fields go where you want them to?
View 13 Replies
View Related
Jan 15, 2008
Hi all!
I am new to the scene, please forgive me if my question or language seems silly
I have this Access 2000 database filled with over 1500 records of people
I need to send these people letters based on their age and gender
I guess I would normally do the gender thing with a mergefield in Word, it'll simply create "Madam" or "Sir" upon an if...then instruction on genderdata in the database. The problem is, there's not two, but there's three options! I'll explain below.
The first option is for kids < 12 y
The second option is for kids > 12 but < 18 AND their parents
The third option is for adults (>18)
So, in fact there's three letters.
Now, what I need a code -or at least the concept- that will tell the database to select and open the right letter by pressing a button in a form.
I can of course make three hyperlinks in the form, one for each letter, and let the user choose, but that's not too fancy is it?
I want the database to make the choice. So, I guess in normal language the instruction needs to select the current record, analyse the age (date-dob) and, depending on the result of that calcultion, it needs to open the correct document in Word.
But here's the point: I'm quite unfamiliar with VBA code
But maybe even a conceptual answer might help!
Thanks in advance!
Arjan, The Netherlands
View 1 Replies
View Related
Jul 5, 2005
I've almost completed the DB I'm working on, but still have a few loose ends to tie up that I can't seem to figure out. I've spent many hours already on this forum searching for solutions, and have tried a few different things, but I still can't work out these bugs.
First, I need my form to open with the latest records filtered first, so that the most recently added records will be easiest to find and edit. I'm not sure how exactly to do this. I've tried a run query when the form is opened, but I still need all the records displayed or accessible. The form is called frmDenial, and I would like it to be looking in the DateLogged field of the form. Any suggestions?
Second, I have command buttons that will export data in the fields to MSWord Templates via bookmarks. The button runs well by opening the document, inserting the data, and printing. I have also tried several different code syntax to close word once it is done, but it is still staying open after printing. Here is a sample of the code:
________________________________________
Private Sub Print_Letter_Click()
Dim objWord As Word.Application
'Start Microsoft Word 2000.
Set objWord = CreateObject("Word.Application")
With objWord
'Make the application visible.
.Visible = False
'Open the document.
.Documents.Open ("G:PharmacyPrior Auth Docs and DataRevised Pharmacy Denial ProcessesKAN Not Nec or Benefit2.dot")
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("bmkFirstName").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRFirst))
.ActiveDocument.Bookmarks("bmkLastName").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRLast))
.ActiveDocument.Bookmarks("bmkHRN").Select
.Selection.Text = (CStr(Forms!frmDenial!MemberNumber))
.ActiveDocument.Bookmarks("bmkAddress1").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRAddress1))
End With
Print_Letter_Click_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
End If
objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
objWord.Application.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = Nothing
Exit Sub
End Sub
_______________________________________
Finally, I have two cascading combo boxes set up that will auto pop related fields based on the selection made. But, if an item is not in the list, I would like the user to add it to the linked table to appear in the list. I also have this working well, with a pop up asking the user if they want to make the addition, type in the new item, and add to the list without requiring the user to refresh or exit then re-enter the form. But it will only add the item name, and not the item description (another field in the form and another column in the table). How can I modify the code to prompt the user to enter these other details? I can link it to a pop up sub form to enter the data, but if possible, would rather the boxes pop up to have the user type in the data. Here is the code I have so far in the NotInList Event...
__________________________________________
Private Sub DrugName_NotInList(NewData As String, Response As Integer)
Dim DB As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available Drug" & vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to add the new Drug to the current Database?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add or No to re-type it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new model?") = vbNo Then
Response = acDataErrContinue
Else
Set DB = CurrentDb
Set rs = DB.OpenRecordset("tblDrug", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!Drug = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
rs.Close
Set rs = Nothing
Set DB = Nothing
End If
End Sub
______________________________________________
The two other colums in the tblDrug that I need the user to be prompted to fill are Denial Reason (column 3) and Alternative (column 4). What would be the best way to accomplish this?
I would really appreciate any help or suggestions with any of these problems. Thank you so much! :o
View 7 Replies
View Related
Apr 10, 2014
I have made a form with different records now my goal is to filter those records and export the details of those records to excisting Word files.
So for instance:
Record filtered on:
Title: TrainingsSharepoint
Location: London
Than it wil export the details to --> Doc1.docx
Or
Title: TrainingSale
Location: Berlin
Than it will export the details to --> Doc2.docx
And so one...
The Word files already have some text in them so i want to set up variables to insert the details in the right place.
View 1 Replies
View Related
Apr 14, 2013
I would like to have a button (cmdPrintIntroLetter) on my Client Details form that takes the client name, address and company data of the record that I'm currently viewing and putting it into an address box in a Word document.
e.g. when I contact a new customer and input their details into my form I want to then be able to send them an introductory letter (standard wording) from me with just the click of a button.
FAO: FirstName LastName
CompanyName
Address1
Address2
Address3
Town
County
Postcode
I've been faffing around with concatenating my address fields into an address textbox in a report but I really don't like using a report to write a letter, it just feels wrong - on every level.I also want another button (cmdEmailBrochure) which opens an email template using the records email address and inserting the name of the client into the body of the email.
View 1 Replies
View Related
May 25, 2015
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.
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
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
Aug 14, 2014
My end goal is to populate a pre-existing table in an MS Word document with records from a query. The easiest way I've found (through scouring the internet) is to start with the code below (ran during OnClick() even in Access) to get the table the same size as the recordset:
Code:
Dim wDoc As Word.Document
Dim wTable As Word.Table
Dim wCell As Word.Cell
Set wDoc = appWord.Documents.Add(strDocLoc)
wDoc.Visible = True
[Code] ....
The code will shrink the table down just fine if the table has more rows than the recordset +1 (for header column). My hangup with this is the last line ("Selection.InsertRowsBelow 5") isn't executing; rows are not being added to the table. I get no errors -- it just does nothing. I set it as "Selection.InsertRowsBelow 5" arbitrarily just to see if it would even add rows, and sure enough it's not.
View 9 Replies
View Related
May 18, 2005
Hi,
I am exporting a table to word and I have come across a problem.
My code opens a template, creates a table with the correct number of rows and columns at a certain position, and then adds data to it.
At this point, everything is fine. But, here is where the problem sticks its ugly head out. I am modifying the column widths and every other time I run it, it crashes, saying something about not being able to access the remote server. Run time error 462.
I have checked in the task manager that word is being quit properly each time and tried going to different templates.
The first time I run it, it runs fine. The second time, it crashes on the line where I change the width. Here is the line of code.
mytable.Columns(1).Width = InchesToPoints(1.2)
I have found that if I close the document after it is created and leave word open, it will run fine.
I think I am in the same boat as mrpauly. But his post date is 23rd April 2001…
http://www.access-programmers.co.uk/forums/showthread.php?t=26363
Has anyone else seen or heard anything like this? I’m really confused…
Thanks for any help anyone can give.
View 1 Replies
View Related
Aug 15, 2007
Hello,
I made a database application and i need some help: in the application i use a script that modifies word documents by opening ms word application, but some customers don't want to install ms word. I'm asking if someone knows tto exist some kind of word runtime that i can modify word documents without having word installed. I'm using also vb6.
Thanks!!!!
View 1 Replies
View Related
Jul 11, 2005
and I want to write in some places
I know to open the word
and write in to the word
to write in to word:
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")
objWord.Visible = False 'True is visible
objWord.Documents.Add ("C:DocumentsTest.dot")
objWord.ActiveDocument.Bookmarks("bmCusDetails").Select
objWord.Selection.Text = Forms![a]![b]
objWord.Visible = True
but how am I write in a special place?
thanks alot, and sorry on my english
View 1 Replies
View Related
Jul 22, 2005
Exporting datasheet to word, how is this possible using vb. Actually, I do have a thread in Form forum. But, I think not a lot of people visit that place. Anyways, I have created bookmarked and used datavariable to export the data (by ansentry's help). But the only thing that it exports is just one selection on that datasheet, instead of all the chosen rows.
I am exhausted now after searching everywhere, and not finding a clue. How to resolve that situation. If there is an example that I can use, that would be gr8.
Thanks In Adv.
View 2 Replies
View Related
Mar 26, 2006
Right the thing is i can export my reports to word but when they export they don't hold the lines that i placed around the text boxes, this is becoming quite annoying as the reason i put the lines around the boxes,was so when the report is output it looks like the original.
Help please!!
View 7 Replies
View Related
Apr 27, 2006
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
...
...
...
View 3 Replies
View Related
Apr 13, 2007
To queries here:
Database is the MS Contacts Template with minor adjustments.
1. Trying to insert a link to an image using a bound OLE object in my form. Now I've got it top work. However, the link appears normal size in the centre of the object box. Problem is when I resize the oject box so that llink text just fits fine. The text resizes with the box and you need a microscope to read it.
2. I want to be able to cerate merged letter but I cant select Tools>Merge it with MS word fro some reason (i've aslo tried with with DB's we use in work with same problem) but publish with Word is available.:confused:
I am by no means an expert with Access so please, please post replies in lamens terms.
Thanks,
Marc
View 2 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 23, 2005
i've a question.
is there a way to associate a word document to a table entry?
i would like to create a database of microsoft word files where you can search for a certain keyword that is linked to a word document. is there a way to do this?
View 2 Replies
View Related
Jun 22, 2007
Hi there
I have a table in my database with a field called description. Imagine if one of my discriptions is "I learn a lot in access world forums". I need a query that if I look only for a word "access" will retrieve this discription. Is this possible to be done in access?
Thanks
View 3 Replies
View Related
Mar 7, 2005
How do I Pubish a from from access into word using a word template i have created? and not just into a blank word document?
View 1 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
Jul 18, 2005
Okay, I searched prolly even hit my head over the keyboard several times to find something resourceful in context to what I am looking for. But I didn’t, if there is something out there and it didn’t appear during my search or I missed it by any chance. Then accept my apologies. Now here is the question.
I have a master form and a subform, now I am able to send my master form to word, and my subform is in the form of datasheet. And this datasheet has a combo box, so the user can select as my options as they want. I want these options to export to word with the master form. I tried doing that through doc variable and also as book mark, but the only thing that’s transferring is the first field. I know couple of ppl went through the same trouble to achieve the same goal as me. And they asked the same question but their queries were un-answered, is it something that can not be done??? I am sure there has to be a way to do this; I am looking for some assistance here. That I will really appreciate.
I know I have a topic going on for a while now, about the same topic. But seem like there is no point of bringing that thread up over again, and it’s kind of dead.
View 1 Replies
View Related
Jul 18, 2005
Okay, I searched prolly even hit my head over the keyboard several times to find something resourceful in context to what I am looking for. But I didn’t, if there is something out there and it didn’t appear during my search or I missed it by any chance. Then accept my apologies. Now here is the question.
I have a master form and a subform, now I am able to send my master form to word, and my subform is in the form of datasheet. And this datasheet has a combo box, so the user can select as my options as they want. I want these options to export to word with the master form. I tried doing that through doc variable and also as book mark, but the only thing that’s transferring is the first field. I know couple of ppl went through the same trouble to achieve the same goal as me. And they asked the same question but their queries were un-answered, is it something that can not be done??? I am sure there has to be a way to do this; I am looking for some assistance here. That I will really appreciate.
I know I have a topic going on for a while now, about the same topic. But seem like there is no point of bringing that thread up over again, and it’s kind of dead.
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