Queries :: Word Recipient List Empty With Access Query
Sep 1, 2014
I have a query in Access and a word document that opens up the query. Currently the query contains every record in the database. If I alter the query in Access to select a certain set of records (based on dates) when Word opens the recipient list is empty. Checking for errors it says there were no records or no data records matched query options.
How can I get Word to open and use the modified query?
Since the last Windows XP update on the secretary PC, all combo lists are now empty even if the related tables are not at all.
Here is her configuration: Windows XP SP 2 Access 2003 SP 3
Here is the description:
1) I've got a combo list based on the table Towns with zip-code, name, country.
2) In the form, in addition the combolist is sorted on the name, just to easily pick up the right Town
3) Since the Windows update, the combo list displays only the zip-code, the other fields are empty even if the table content is not empty at all; I mean I checked in the table content itself.
4) I created a query based on the same arguments of the combo list and the query is working well alone; if I try to create a new combo list linked to the query, then I get the same weird result
5) I've tried to create a new field with the combo list assistant; when I select the table Towns, it shows me the full content (so name, zip, country) and when I run the form, the combo list is again almost empty !!
6) What is more weird is that when I put the Access database back on my standalone laptop which is running Access 2002, the combo list is working correctly !! In fact I am currently maintaining the Access database from my Access 2002 since more than one year and I had no issue
7) In fact, I got the same issue with all the combo-list in my Database
8) I tried to compact the DB but with no effect
Somebody has a brillant idea for me ?? otherwise I think I will contact Mister Bill directly :)
I have attached a DB that I am trying to create for my small business. Every month we have renewals of the client’s yearly contracts. I have created a form called frmRenewells, on this form you need to select a month and a year (please choose October 2006) this then runs query qryRenewell. The query then opens form frmRenewellSheet with the results. This works fine, but I really need the following to happen:
Open form frmRenewells and enter month & year, on clicking the enter button it launches a word template I have created and automatically pulls all the fields required into the word document. I can then press print and it will print a document for each client in the query.
I am unable to go into word and just open the query as it has * or wildcards in it. Therefore word will not allow me to select the query.
I have a created a query which I want to update a table. The field is called DTP. I have the Workingdays2 module in place as well as the Holidays Table. The dates (date only) are called Time in and Transaction date. I want the table to update records only if the entry in Completed is Yes. I have attached screenshot of what I have in query. I am no good whatsoever at VBA so I used the Query design view. It shows how many records will be updated (which is a valid number) and shows me which field will be updated. However when I run the query and then opend the Table the DTP field is empty.
I'm trying to write record set contents to excel. My query runs perfect in access query wizard, but recordset showing as null. My VBA code
Code:
Dim cnn As ADODB.Connection Dim recordst As ADODB.Recordset Dim strSQL As String Dim strPath As String Dim appXL As Excel.Application Dim wb As Excel.Workbook
In my access form I provide the user a list of locations from various countries in a listbox . But the list is too long so I provide him a combobox for selecting a country. Selecting the country should update the listbox showing only the locations in that specific country.
So my SELECT from the listbox must cover the unselected state and show all entries and when a country is selected it must narrow the selection.
I tried to get this happen with the following SELECT statement containing a variable. Choosing a country in the Combobox results in a change of the variable and in a requery. This works after the first country is selected and for each country change, but the initial list is empty.
VBA in the loadform 'Application.TempVars.Add "varcountryselect", "*" SELECT in the listbox "lstlocationsperproject" SELECT tbllocations.locationID, tbllocations.country, tbllocations.localstreet, tbllocations.localcity FROM tbllocations WHERE ((tbllocations.country) Like [TempVar]![varcountryselect]);
VBA in the combobox Application.TempVars("varcountryselect") = [Form]![kombcountryselect].Column(0) Me.lstlocationsperproject.Requery
The values in [kombcountryselect].Column(0) are texts like "SPAIN", "MEXICO", etc.
Any hints, how I have to use the * for getting the complete list on the initial view ?
I am just querying a single table, no relationship involved with another table. As you can see form the attached jpeg, the ZIP field in some cases is empty. I would run a search using Is NULL but the field is NOT numerical. It's a long story but I had to make this field a TEXT field. Basically, what statement do I have to insert in the criteria field to just pull up the EMPTY ZIP fields?
Can you set up a list box so when the form opens the list box is on a blank value at the start of the list. At the moment it opens with the first option selected. I have tried playing with the default value but this doesn't work.
I have created a form with a list view (active-x) to be able to control colors, etc in a list.
When I open my form, it is already information (three rows) in the list view. This despite the fact that I have shut down the access application and even shifted the database to another computer.
I can of course delete the elements with ListItems.Clear when I open the form, but I'd rather like that they did not show up at all.
Where these "default-elements" are stored, so I can remove them from the list view once and for all?
I was trying to filter a word using Not Like "word" in my query cirteria, some data is blank also, From this record i want to retrieve the result. But when i use Not Like Criteria, filter is working but blanks columns are also filtered.
I want to display all records (including blanks) except what i shown in the criteria.
Apologies ... but I am quite new to Access. My database contains about 1000 peoples' addresses.
The problem I have is that I need to merge, say, 20 of these addresses into a word document. In the word document I can select records using the "Surname" field but it will not give me the option to select more than 6. I am sure there must be a way that I can select more than 6: I have tried separating the surnames with a "," or "or" but nothing seems to work!
Is it possible to link a field in Access to a footer in Word?
I have a field in Access that would look like the following;
G10E-PRO-001RevA
Additional data in access would have the document name, and revision, matching 2 lines of text in Word. I would like the footer in the document to be the above sample, which I assume could be a query that need to run to match the 2 fields of information.... not really sure if this is even possible?
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
I am trying to send an MS Access 'report' as an attachment to a mail recipient in rtf format without success. Everything seems to work fine except the 'send' button. Click away and nothing happens.... no error messages, no nothing. Any suggestions or tips on how to make this work?
I have created a database that auto emails and works well, my problem now is that though there are multiple emails to send to it is only sending to the first one. The way I have set this up is I have created a qry to combine all emails using Allen Brownes concatrelated in below
Code: SELECT DISTINCT Left([Copy Of tbl_Depot]![Depot],3) AS Port, ConcatRelated("[Copy Of tbl_Depot]![ContactEmail]","[Copy Of tbl_Depot]","[Copy Of tbl_Depot]![Port]=""" & Left([Copy Of tbl_Depot]![Depot],3) & """") AS Email FROM [Copy Of tbl_Depot];
I then link this to an append qry which becomes my data source
Code: INSERT INTO tbl_dptem ( [Empty Return Location], [Container], ContactEmail, DepotEmSent ) SELECT qry_emdepot1.[Empty Return Location], ConcatRelated("[qry_emdepot1]![Container No]+chr(13)+chr(10)","qry_emdepot1","[qry_emdepot1]![Empty Return Location]= """ & [qry_emdepot1]![Empty Return Location] & """") AS [Container], qry_Portem.Email, qry_emdepot1.DepotEmSent FROM qry_Portem RIGHT JOIN qry_emdepot1 ON qry_Portem.Port = qry_emdepot1.[Empty Return Location] GROUP BY qry_emdepot1.[Empty Return Location], qry_Portem.Email, qry_emdepot1.DepotEmSent;
Below is the code I use to auto send emails and when I check it shows all email addresses in sent email but it is only going to the first recipient.. not sure what I need to do so all of them get it.
Code: Sub EmDepot() Dim Notes As Object Dim Maildb As Object Dim MailDoc As Object Dim objNotesDocument As Object Dim objNotesField As Object
I have been able to create code to send email for my ticket system but now have a need to add an additional recipient. I would prefer this recipient to be add in the CC field. This email address will come from its own table. I have tried to figure this out myself but I can't get anything to work for me . I am fairly new to VBA and all of my experience is just through trial and error (mostly error). I have attached my original code below ....
Private Sub cmdMailTicket_Click() On Error GoTo Err_cmdMailTicket_Click Dim stWhere As String '-- Criteria for DLookup Dim varTo As Variant '-- Address for SendObject Dim stText As String '-- E-mail text
I have the following code (which everyone uses) but I have a challenge.
I ONLY want to use two (maybe three) fields from the database! (Subject & Body... with the POTENTIAL of an attached document.
I want to fill in the "to" section AFTER the email is open. This will allow me to make changes if I need to before it is sent.
Here is the code I am trying to work with. (It should look familiar) but I can't get it to keep outlook open!
Code: Private Sub SecondEmail_Click() 'open Outlook, attach zip folder or file, send e-mail Dim appOutLook As Outlook.Application Dim MailOutLook As Outlook.MailItem
I ran into this error message with the SendObject method. I'm getting the email address from the "username" environment variable. Our company generally uses the logon ID as the first part of everyone's email address, but there are some users that get this error: "Unknown message recipient; the message was not sent" Not only that, if two sendobjects are used one after the other, sometimes it sends to the first person and then the second one is set up to send a copy back to the sending user, it doesn't recognize the recipient that's logged on and is actually trying to send the email. That's the one that comes from the environment variable. But I've tried hard-coding the recipient and bypassing the variable altogether and it still generates the same error.
I have a DB where you there's 5 tables all linked together by one project ID
tables below
Project , Staff, Asset, allowances, travel, mark up
What I can do is create a new project, then add records to each of the other tables on what different items I require,
i.e. I create a new project - called project one, in the project table I create a record stating, name, time scale, client and location, then I add different records to each of the other tables on what I require all linked to the same project ID. (probably not explained that too well)
Now I want to create a query that lists all the requirements one after the other this will make it easier to create reports and to calculate costing's.
At the moment I have made 5 different queries listing all the data, then have one report containing 5 sub reports to display the data, no this does work.
I am trying to send tasks to other people using access vba. I had used before in my database but was using early binding and now through version issues of office I am trying to recreate the code using late binding, however I am getting various problems with certain lines of code.
Primarily .datedue line I am getting run time error 438 object does not support
Below is my code:
Public Sub ASB5PostponedTask() Dim olApp As Object Dim olTask As Object Dim olDateEnd As Date Dim ToContact As Object Dim olTaskOwner As String olTaskOwner = "e.grainger"
I also have a table that list the items and on that table the column ItemID is the key.I want to create a query that will list all items ordered on a PO# and how many have been received so far. With that I will calculate the outstanding qty. I want to see:
I have a list box (List25) that is generated from a query (qryThisBox). One of the fields in that query uses the criteria [Forms]![MyForm]![SelectedField] to filter.I also have combo boxes in the form that List25 displays in. Unfortunately, I want to requery the list box in the form, using a combo box that calls the same underlying table field, SelectedField.
How can I do this? Can I somehow dynamically change the criteria in qryThisBox to change when it gets requeried?How do I stack combo box requeries, eg: Combo Box 1 gets selected - does a requery
and/or
Combo Box 2 gets selected - and filters the results of the requery for Combo Box 1.
I currently have a database of customer information and form set up with a MultiList box based on the regions those companies are based. You select the region(s) you require from the list box, click a button and it runs a query.
However I now want to be able to filter the results further using a combo box with business sectors in also.
The code used for the multilist box is as follows (I don't totally understand all the code if I'm honest, but it works )
Private Sub Command2_Click() Const cstrQuery As String = "CAMPQRY" Dim strNames As String Dim strSelect As String Dim StrWhere As String Dim varItm As Variant
I have a query that allows the user to put in a date range - this works.He also wants to limit what he prints.
For example at the moment he gets
OrderA rest of line 1 for orderA OrderA rest of line 2 for orderA OrderA rest of line 3 for orderA OrderB rest of line 1 for orderB OrderC rest of line 1 for orderC OrderC rest of line 2 for orderC OrderD rest of line 1 for orderD . . .OrderZ etc
He only wants to say print lines for OrderA and OrderD. It's he's choice and not based on anything else already in the table.
I see that in the criteria on the design for the query it allows me to bbuild an expression and I can select a list box on the form such as
[Forms]![name of form where list box is]![name of list box].[EXPRESSION VALUES]
I don't know which expression value to choose. I have tried afterupdate and beforeupdate but none of the rest look like they are the ones I should be using.
How do I signal that a query has produced an empty dataset. I have a form that asks for some data via a query and if invalid data is entered I get a blank form. I would prefer an error message to be displayed rather than the blank form. Any ideas or I am I missing something really simple?:confused: