-
WSrrdavis
AskWoody LoungerSteve–
Thanks for your reply. Since I find the Access chart-making feature rather limiting, I really need to keep Excel in the loop. So…
I am trying to figure out the code necessary for updating the links in Excel and saving the file. I have created a reference in Word to the Excel object, and added the the following code to the Word’s Open procedure:
Private Sub Document_Open()
Dim ES_MCRTOT As Object
Set ES_MCRTOT = GetObject(“es_mcrtot.xls”)
With ES_MCRTOT
.Sheets(“Data_Totals”).Select
.Range(“A2”).Select
.Selection.QueryTable.Refresh
.Sheets(“Totals”).Select
.ActiveWorkbook.Save
End WithEnd Sub
The idea is to have Word automagically open the Excel file, refresh the data and save the file. When I open the Word file that contains this Open procedure, the embedded charts update their link, but there isn’t any indication that the procedure fires. I have tried to add a breakpoint to the procedure, but it doesn’t seem to save so that when I save the procedure, close Word and reopen the document, my breakpoint is no longer there.
So…Does anybody know what I’m doing wrong–and once I get the procedure to fire, does anyone see anything wrong with my code?
-
WSrrdavis
AskWoody LoungerSteve–
Thanks for your reply. Since I find the Access chart-making feature rather limiting, I really need to keep Excel in the loop. So…
I am trying to figure out the code necessary for updating the links in Excel and saving the file. I have created a reference in Word to the Excel object, and added the the following code to the Word’s Open procedure:
Private Sub Document_Open()
Dim ES_MCRTOT As Object
Set ES_MCRTOT = GetObject(“es_mcrtot.xls”)
With ES_MCRTOT
.Sheets(“Data_Totals”).Select
.Range(“A2”).Select
.Selection.QueryTable.Refresh
.Sheets(“Totals”).Select
.ActiveWorkbook.Save
End WithEnd Sub
The idea is to have Word automagically open the Excel file, refresh the data and save the file. When I open the Word file that contains this Open procedure, the embedded charts update their link, but there isn’t any indication that the procedure fires. I have tried to add a breakpoint to the procedure, but it doesn’t seem to save so that when I save the procedure, close Word and reopen the document, my breakpoint is no longer there.
So…Does anybody know what I’m doing wrong–and once I get the procedure to fire, does anyone see anything wrong with my code?
-
WSrrdavis
AskWoody LoungerGraham–
Thanks for the information. I’ll keep your Make Table solution handy. I am interested in your “care needs to be taken when opening tables” comment. Is this because Access has a hard time handling the number of records (which I’m sure is true–one of the files in this database has over 8M records), OR are you saying this causes a performance degradation in the AS/400. Does querying the AS/400 cause any performance issues? My marching orders are that my solution should have little or preferrably no decernable performance degradation on the AS/400.
Randy
-
WSrrdavis
AskWoody LoungerGraham–
Thanks for the information. I’ll keep your Make Table solution handy. I am interested in your “care needs to be taken when opening tables” comment. Is this because Access has a hard time handling the number of records (which I’m sure is true–one of the files in this database has over 8M records), OR are you saying this causes a performance degradation in the AS/400. Does querying the AS/400 cause any performance issues? My marching orders are that my solution should have little or preferrably no decernable performance degradation on the AS/400.
Randy
-
WSrrdavis
AskWoody LoungerThanks for you help.
-
WSrrdavis
AskWoody LoungerThanks for you help.
-
WSrrdavis
AskWoody LoungerThanks to hans and Wendell for helping me figure this out. I manually added in the apostrophe in Excel prior to importing it to Access, and everything worked fine. Now I get to go back and find out what was different in that field in the first place.
-
WSrrdavis
AskWoody LoungerHans–
Yes, it does seem strange. The data starts out as an Excel file. I import it into Access then back out again as a text file so that I can get the fields encapsulated by quote marks. (If you know of an easier way to do this, I’m all ears.) There really is no database, but I attached the one that included the table imported from the Excel file, the original Excel file and the text file that was exported.
Here is my process.
- Import TestDemos.xls to Access using File|Get External Data…|Import…
- In the Import Wizard, check No Primary Field. Import the header row to make troubleshooting easier. Accept all other defaults.
- Once the data has been imported, export the newly created table by right clicking the table and click Export…
- Change Save As Type to Text Files and click Export
- On the first screen of the Export Wizard, note that the SSN field has quotemarks surrounding the field, whether blank or populated. Notice also that other fields are blank and have quotemarks surrounding the field. Everything looks as it should here.
- On the second screen, ensure that the delimiter is a comma and that the Text Qualifier is a quotemark. This should be the default. Click Finish.
When you view the resulting text file, note that there are no quote marks around the SSN field. The strange thing is that other field that are blank have the quotemarks as they should. It is only the SSN field. I see nothing out of the ordinary with it either in the original Excel file or in the imported table in Excel.
-
WSrrdavis
AskWoody LoungerJuly 8, 2003 at 1:37 pm in reply to: Programatically Adding record to recordset (AXP (2002) SP-1) #692011Thanks for your help. I bow to your superior knowledge
I did have the DAO 3.6 reference set, but the ADO 2.1 reference was set with a higher preference.
-
WSrrdavis
AskWoody LoungerJuly 7, 2003 at 10:56 pm in reply to: Programatically Adding record to recordset (AXP (2002) SP-1) #691870OK Hans…
One more part of my form I can’t get to work right.
I know, I know… I need to start paying you by the hour
The piece you helped me with earlier today added a record to a table. This one is suppose to delete a record from the table (in case the wrong one is added, or something).
Here’s what I have:
Private Sub lstCatResend_DblClick(Cancel As Integer)
Dim rstCatResend As Recordset
Dim var1 As String‘set var1 to PopID
var1 = Me!lstCatResend.Column(0)Set rstCatResend = CurrentDb.OpenRecordset(“tblVCXPlus_CatUpdt_temp”, dbOpenTable)
rstCatResend.Index = “PopID”
With rstCatResend
.Seek “=”, var1
.Delete
End With
rstCatResend.Close
Me!lstCatResend.RequeryEnd Sub
You’ll notice I took your advise and changed the name of the table.
This is the same code I used in another database. It worked there, but here I get a runtime error on the Set rstCatResend line, stating Type mismatch.
I know there is a limitation with OpenRecordset and linked tables, but tblVCXPlus_CatUpdt_temp is not linked. Any thoughts.
Thanks
-
WSrrdavis
AskWoody LoungerJuly 7, 2003 at 6:35 pm in reply to: Programatically Adding record to recordset (AXP (2002) SP-1) #691823Yes, tblVCX+CatUpdt_temp is a table. After enclosing it in brackets, it worked like a charm. Thanks for your help!!
-
WSrrdavis
AskWoody LoungerJuly 7, 2003 at 4:46 pm in reply to: Programatically Adding record to recordset (AXP (2002) SP-1) #691782Hans–
Thanks for your response. I like your idea of just adding a field to the members table to toggle whether that member needed attention. However, I am reporting out of a SQL database that I cannot modify. So everything I need to do has to be done without altering the underlying database. It presents some challenges sometimes. (Just to be complete, I have created the Access database by linking to all the SQL tables. Only then can I write queries, design forms and add supplementary tables.)
Your suggestion about using an SQL statement really hit the mark. However, the Currentdb.Execute method will not execute. When that procedure fires, the de###### pops up highlighting that line. CurrentDb points to the correct database. strSQL evaluates correctly. Do you have any suggestions as to what might be wrong here?
-
WSrrdavis
AskWoody LoungerJuly 3, 2003 at 8:25 pm in reply to: Programatically Adding record to recordset (AXP (2002) SP-1) #691046Sorry about the confusion. I sometimes feel like I put TMI (Too Much Information) in my questions, and then when I don’t…
I use the textbox’ Change Event to trigger a Function that uses the FindFirst Method on the list in Listbox1. This sort of works like a combobox search in that with each letter that is typed into the textbox, the listbox scrolls down to the appropriate spot in the list. The combobox search doesn’t keep the list open, while this type of seach does.
The recordset (a query, actually) for the listbox has multiple columns. In order to make the listbox search solution work, the field I’m searching on must be the bound field. For example, since I’m typing in the last name in the textbox, I have bound the listbox to the column containing the last name. (Actually, a concatenated LastName-comma-FirstName field).
The purpose of searching through the listbox for a particular name is that I want to double click on the item in the list and have a value from a different column populate to a table. ***TMI WARNING—>> This particular form is to be used in management of a membership group. Throughout the week, I will be “selecting” member records that require a specific action. I want to add the PopID to a table. At the end of the week, I process the records in the table using another procedure, clear the table and start over the next week.
So, I want to double-click on a record in the listbox and have a value from the record added to a table. AddNew first comes to mind, but since I want to add a value other than the bound column, I’m unsure how to proceed. Any hints?
Thanks.
-
WSrrdavis
AskWoody LoungerSome fixes are just too easy. Thanks, Steve!!
-
WSrrdavis
AskWoody LoungerHans–
Thanks for you help. Before I got your response, I worked out the following logic:
Call Time (min): Sum(IIf([time_out]=””,0,(IIf([caller_cd2]=””,(DateDiff(“n”,[time_in],[time_out])),(DateDiff(“n”,[time_in],[time_out])+CInt([caller_cd2]))))))
It works, but yours is not as complex. Nested IIF statements make me
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
DOGE Wants to Replace SSA 60 Million Line COBOL Codebase in Months
by
EyesOnWindows
44 minutes ago -
KB5051989 Usb printer Post Ipp
by
licencesti
54 minutes ago -
Removing bypassnro
by
Susan Bradley
14 minutes ago -
Up to 30 seconds to show “Recent Topics”
by
PL1
4 minutes ago -
Sound changes after upgrade from W11 23H2
by
WStaylorpsepa
1 hour, 35 minutes ago -
Windows bug blocks BIOS updates for Lenovo ThinkPad laptops
by
Alex5723
4 hours, 38 minutes ago -
O&O Software – ‘World Backup Day’ Sale
by
unbob
58 minutes ago -
Still version 23H2?
by
WSbxcfilm
5 hours, 26 minutes ago -
Ubuntu 25.04 (Plucky Puffin) Beta released
by
Alex5723
11 hours, 23 minutes ago -
How to install App Store apps on an external SSD
by
Alex5723
12 hours, 17 minutes ago -
Where is Windows going?
by
Susan Bradley
2 hours, 34 minutes ago -
Installing Feature Update Windows 11 24H2
by
geekdom
1 day, 5 hours ago -
Windows 11 Insider Preview build 27823 released to Canary
by
joep517
1 day, 6 hours ago -
Windows 11 Hotpatch
by
Hackmuss
13 hours, 27 minutes ago -
System Guard service error still won’t be fixed
by
Susan Bradley
1 day, 6 hours ago -
Operation ForumTroll: APT attack with Google Chrome zero-day exploit chain
by
Alex5723
1 day ago -
Troy Hunt of HaveIBeenPwned Phished
by
Lars220
22 hours ago -
Microsoft Windows security auditing Code 5061
by
mpw
1 day, 19 hours ago -
Can’t display images in incoming Outlook 365 emails
by
WScopwriter
1 day, 2 hours ago -
Windows 11 Insider Preview Build 26200.5510 early builds of 25H2
by
Alex5723
1 day, 4 hours ago -
0Patch : Micropatches released for SCF File NTLM Hash Disclosure Vulnerability
by
Alex5723
1 day, 3 hours ago -
Select multiple emails and they all open up!
by
CeeJay
2 days, 20 hours ago -
How to remove an update preview
by
Gunny
23 hours, 18 minutes ago -
Third party add ins reminder
by
Susan Bradley
6 hours ago -
OTF, which backs Tor, Let’s Encrypt and more, sues to save its funding
by
Nibbled To Death By Ducks
2 days, 14 hours ago -
Updating Windows 10 to Windows 11: 23H2 or 24H2?
by
Still Anonymous
3 days ago -
How can I update “Explorer Patcher”
by
WSplanckster
3 days, 2 hours ago -
Check out the home page for Signal
by
CAS
3 days ago -
Windows 11 and Trial version of MS Office
by
Tex265
2 days, 23 hours ago -
Windows 11 Insider Preview build 26120.3585 (24H2) released to BETA
by
joep517
3 days, 7 hours ago
Recent blog posts
- Removing bypassnro
- Where is Windows going?
- System Guard service error still won’t be fixed
- Third party add ins reminder
- MS-DEFCON 4: Mixed bag for March
- Classic and Extended Control Panel — no need to say goodbye
- Things you can do in 2025 that you couldn’t do in 2024
- Revisiting Windows 11’s File Explorer
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.