I have a Macro that calls a form. The form has a Combo Box from which the user selects which Department they wish to see.
Unfortunately, the Macro keeps on trucking while the selection is being made. How do I get the Macro to pause for input before continueing.
This same Macro worked fine with a dialog box, but a dialog box doesn’t give me the ‘choose from a list’ capability.
Thanks in advance.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Pauseing a Macro (2000)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Pauseing a Macro (2000)
- This topic has 17 replies, 5 voices, and was last updated 22 years, 2 months ago.
AuthorTopicWSladygnome
AskWoody LoungerFebruary 11, 2003 at 2:09 pm #383174Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody LoungerFebruary 11, 2003 at 2:18 pm #652580I don’t think you can do that in a macro. I tried setting the WindowMode argument of the OpenForm action to Dialog, but that doesn’t stop the macro from continuing. If you convert the macro to VBA, the code will pause if you open a form with WindowMode:=acDialog until the user closes the form. You can convert a macro to VBA by selecting it in the database window and selecting File/Save As… from the menu.
-
WSAndyAinscow
AskWoody Lounger -
WSladygnome
AskWoody Lounger -
WSAndyAinscow
AskWoody LoungerFebruary 11, 2003 at 5:26 pm #652626Everyone has to start somewhere. Basically if you can code a macro then you can use the same logic for the VBA coding. One thing to help you is look at the code the wizards produce for performing actions. Also there are plenty of code snippets on this site.
It’ll be worth your while to get a book or two. For Access specifically look for the Access Developers Handbook by Litwin, Getz and Gilbert. Reading it will keep you occupied for about the lifetime of the universe! (It’s a monster). Having said that you probably won’t have to ask any more questions here for quite some time if you understand it. -
WSpatt
AskWoody Lounger -
WSPatricia W
AskWoody LoungerFebruary 11, 2003 at 8:16 pm #652680And if you don’t want to go VBA right now, what you can do is split your macro into two — have one that opens the form, and another that runs the information after you have made a selection from the list (or, better yet, from a button that says “okay, process my choice now,” or words to that effect. You can call your macro from the “event” properties of the button (“onclick”) or list selection (“afterupdate”). I agree w/ everybody, though about how much more control you have in VBA, but this might get you by for right now.
thx
Pat -
WSladygnome
AskWoody Lounger -
WSAndyAinscow
AskWoody Lounger -
WSladygnome
AskWoody LoungerFebruary 12, 2003 at 1:27 pm #652890Okay, I’m game to try.
Let’s start with Hans answer. This can’t be all you type. What -exactly – do I need to type in the Code window to 1. Turn off Warnings, 2. Open my form and wait for input, 3. Run my query, and 4. Export to Excel.
Yes, I know I could do a report. But this is what my supervisor wants. He likes to see the results in an Excel spreadsheet. -
WSpatt
AskWoody LoungerFebruary 12, 2003 at 7:05 pm #652973What you need to do first is to set up a button on the form that you has the Department number ComboBox.
Make a button on this form, set it up to print a report, any report just so it generates code to print the report and the error coding.
You need to go into the code window, if you don’t know how to do this just click on the button you have just generated and go into properties, then go to the OnClick event and click just to the right of the wording event procedure and it will open up the VBE (Visual Basic Editor) Window.
Mark and delete the code:stDocname=…
DoCmd.OpenReport…and enter the following code:
DoCmd.SetWarnings False
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, “Your Query Name”, “Path and Fielname of your Excel Spreadsheet”, True
DoCmd.SetWarnings TrueThat’s all there is to it.
Don’t forget to substitute your Query name for “Your Query Name”, and the path ans filename for your spreadsheet (eg. c:Path…YourSpreadsheetName.xls).Post back if you have any problems.
Pat -
WSladygnome
AskWoody LoungerFebruary 12, 2003 at 7:49 pm #652980DoCmd.SetWarnings False
This looks like it will accomplish step oneStep 2 is to Open the Form and wait for input. A button on the form wont really work for this
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, “Your Query Name”, “Path and Fielname of your Excel
Does this run the Query before exporting?? If not, I need the code to run the query before exporting itLooks like step one and step four may be solved, now — how do I run this module (Is that the right word?) Since a button on the form wont really do it.
Can’t tell you how much I appreciate your time.
Spreadsheet”, True
DoCmd.SetWarnings True -
WSpatt
AskWoody LoungerFebruary 12, 2003 at 7:57 pm #652984You mention about opening a form, does this form require you to input something for the query, if so, then you may as well put the button here. Unless I misunderstood something about the forms you are talking about.
You don’t need to run the query as it’s run in the DoCmd.TransferSpreadsheet statement.
Pat
-
WSladygnome
AskWoody LoungerFebruary 12, 2003 at 8:55 pm #652998Pat,
This is the same form/query that we are working on to get it to show all my accounts when I don’t chose a department. I just thought I’d truck on to the next step while trying to get that right.
The goal here, (per my supervisor) is to have a seamless operation. Choose a requirement (Maybe from a menu?) and Access opens the correct form, runs the correct Query, and exports the results to Excel.
He isn’t unhappy with what I’ve done so far. He just wants this to be usable by TRUE Access novices, who wouldn’t know a Query from a Grocery List.
Yes, you saw that right. Creating a menu – switchboard? – will be my next chore.Could not have gotten as far as I have without the help of this list.
-
WSpatt
AskWoody LoungerFebruary 13, 2003 at 12:54 am #653032(Edited by patt on 13-Feb-03 12:54. Include database)
Have a look at this database and you will see what I mean by the form doing all the work.
You will have to redirect the output of the DoCmd.TransferSpreadsheet statement, because as it stands it will go to c:data as the directory.If you have any questions, please post.
Pat -
WSladygnome
AskWoody Lounger -
WSladygnome
AskWoody LoungerFebruary 17, 2003 at 4:43 pm #654262Hi Pat,
I’m answering here the question you asked on my combo box question, because it really relates to this question. After copying your Form (and related queries and tables) into a new database, to try and get your form to combine with the form to choose a dept. — even if I choose an account on the form, when I click the export button, it pops up a box for me to type in the account. Then a second for the last account.
Sigh—-. -
WSpatt
AskWoody Lounger
-
-
-
-
Viewing 1 reply thread -

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
-
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
4 hours, 21 minutes ago -
AI slop
by
Susan Bradley
3 hours, 31 minutes ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
5 hours, 37 minutes ago -
Two blank icons
by
CR2
12 hours, 7 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
14 hours, 31 minutes ago -
End of 10
by
Alex5723
17 hours, 12 minutes ago -
End Of 10 : Move to Linux
by
Alex5723
17 hours, 41 minutes ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
14 hours, 10 minutes ago -
test post
by
gtd12345
23 hours, 12 minutes ago -
Privacy and the Real ID
by
Susan Bradley
13 hours, 20 minutes ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
5 hours, 26 minutes ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
1 day, 3 hours ago -
Upgrading from Win 10
by
WSjcgc50
4 hours, 56 minutes ago -
USB webcam / microphone missing after KB5050009 update
by
WSlloydkuhnle
22 hours, 39 minutes ago -
TeleMessage, a modified Signal clone used by US government has been hacked
by
Alex5723
1 day, 19 hours ago -
The story of Windows Longhorn
by
Cybertooth
1 day, 6 hours ago -
Red x next to folder on OneDrive iPadOS
by
dmt_3904
1 day, 21 hours ago -
Are manuals extinct?
by
Susan Bradley
8 hours, 40 minutes ago -
Canonical ditching Sudo for Rust Sudo -rs starting with Ubuntu
by
Alex5723
2 days, 6 hours ago -
Network Issue
by
Casey H
1 day, 17 hours ago -
Fedora Linux is now an official WSL distro
by
Alex5723
2 days, 18 hours ago -
May 2025 Office non-Security updates
by
PKCano
2 days, 18 hours ago -
Windows 10 filehistory including onedrive folder
by
Steve Bondy
2 days, 20 hours ago -
pages print on restart (Win 11 23H2)
by
cyraxote
1 day, 21 hours ago -
Windows 11 Insider Preview build 26200.5581 released to DEV
by
joep517
2 days, 22 hours ago -
Windows 11 Insider Preview build 26120.3950 (24H2) released to BETA
by
joep517
2 days, 22 hours ago -
Proton to drop prices after ruling against “Apple tax”
by
Cybertooth
3 days, 6 hours ago -
24H2 Installer – don’t see Option for non destructive install
by
JP
1 day, 22 hours ago -
Asking Again here (New User and Fast change only backups)
by
thymej
3 days, 17 hours ago -
How much I spent on the Mac mini
by
Will Fastie
1 day, 1 hour ago
Recent blog posts
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.