-
WSClausParkhoi
AskWoody LoungerThe code I gave you in my first reply works fine as long as you don’t have multiple instances of a form.
From your originally description I understood that you would like to close all other forms but the one currently selected.
This code makes sure NOT to close the form using/calling the code. Unlike other methods there is no reason to refresh form count variables and do multiple loops since my loop starts examining the highest numbered form.
And since we are using the Forms collection (open forms only), there is no reason to check if a form is open.
I have changed the code a little to make it easy for you to insert it in a module (not class module).
It’s a function, so you don’t even have to call it from VBA code in a class module unless you have other things to do in the event chosen to call the function.
In the events section of a form’s property definitions choose the Load or Open event and type directly: =CloseAllOtherOpenForms([Form])
Be sure to type it eactly like that, i.e. don’t change [Form] to anything else.
If you do have other VBA code for the chosen event include this line: Call CloseAllOtherOpenForms(Me)Public Function CloseAllOtherOpenForms(frm As Form) As Boolean
Dim intI As Integer
‘ Close all open forms except the calling form
For intI = Forms.Count – 1 To 0 Step -1
If Forms(intI).Name frm.Name Then ‘ Do not close the calling form
DoCmd.Close acForm, Forms(intI).Name
End If
Next intI
End Function -
WSClausParkhoi
AskWoody LoungerYou may use the following code to close all open forms except the one having the code.
Dim intI As Integer
‘ Close all open forms except Me
For intI = Forms.Count – 1 To 0 Step -1
If Forms(intI).Name Me.Name Then ‘ Do not close Me
DoCmd.Close acForm, Forms(intI).Name
End If
Next -
WSClausParkhoi
AskWoody LoungerJanuary 19, 2002 at 3:35 pm in reply to: Convert UK General date format (gdf) to US gdf (Access 2000 sr.1) #564849Note to my previous reply:
What I wrote about using a certain US format (like jan-17-2002) was not about defining a format. It was about typing input in that format. -
WSClausParkhoi
AskWoody LoungerJanuary 19, 2002 at 3:16 pm in reply to: Convert UK General date format (gdf) to US gdf (Access 2000 sr.1) #564841I thought you were referring to display formats only (see my previous reply).
As for input you you can perfectly well use the US format: jan 17 2002 or jan-17-2002.
Be carefull not to use the US input format: 1/17/2002 (2002-01-17). It will be allright for that date but for 1/10/2002 it won’t work. The latter will be taken as a european date (2002-10-01) when your International settings in the Windows Controlpage are UK settings.
If you choose to input your dates as jan 17 2002, or jan-17-2002 or 2002-01-17 you’ll be allright. -
WSClausParkhoi
AskWoody LoungerJanuary 19, 2002 at 12:31 pm in reply to: Convert UK General date format (gdf) to US gdf (Access 2000 sr.1) #564801In tables, forms and reports use the format property to specify your date format (e.g. mmm dd yyyy).
In code use Format(yourdateandtime,”mmm dd yyyy hh:nn:ss”).For information about international settings use Access help. Type this in the Office assistant: international dateformats
-
WSClausParkhoi
AskWoody LoungerExcept for a missing “)” in your first Kill stmt your code seems OK. Check the spelling of the path names in your consts defining the dbs.
-
WSClausParkhoi
AskWoody LoungerSorry to disagree Tom,
There is no reason to look up the ClassID. It should be the bound column of the Class combobox.. Take a look at my sample db, and I’am sure you’ll agree.
-
WSClausParkhoi
AskWoody LoungerAre you missing a space before and after the & ????
Try this: SET [IQC Proficiency].Sample = “Sample ” & mid((IQC Proficiency].Sample,8))
-
WSClausParkhoi
AskWoody LoungerThe name of your report is hopefully in stDocname. Look at the code preceeding the DoCmd.
Replace ECR Report by the name of your form inclosed in [] if it contains spaces.
If your form is name ECR Form the stmt should look like this:DoCmd.OpenReport stDocName, acPreview, , “[ECR_Number]=forms![ECR Form]!ECR_Number “
-
WSClausParkhoi
AskWoody LoungerHi Randall,
It seems you are trying to assign a string (the SELECT stmt) to a Long (ClassID).
I had some spare time. So, to help you, I’ve prepared and attached a small sample database for you. It shows you how you can control a class/student registration job using a combobox for class selection and two listboxes displaying students. One listbox has students selected for the class, the other one has students you may select for inclusion in the first list.
Select a class and the listbox at your right hand can be used for adding students to a class and the listbox at your left hand will display students already selected. I’ve included a button to remove students selected, in case you need that.
The sample database has 3 tables (tblClass, tblStudent, and tblClassRegistration) with selfexplaning names. Take a look at the relations.
There are 2 queries both of which depend on the form frmClassRegistration being open. One query has students selected for the class selected on the form, and the other one has students not selected for the class on the form.
I am using multiselect lists.
To select one student: doubleclick the student.
To do multisection of students: 1. press left mouse button while selecting multiple consecutive rows or 2. click ctrl and left mouse button on several individual rows. And then click the register students button.I hope you will find my sample application (Office 97) helpfull.
-
WSClausParkhoi
AskWoody LoungerIn your query type in the criteria for Dept on consecutive rows like this:
“Admin”
“Accounts”
In(“Marketing”,”Sales”)
In(“HR”,”Maintenance”)
Like “*”In a new column of your query type:
Combo:Forms![frmMenuForm]![Dept]In Combo’s criteria type (consecutive rows):
“Admin”
“Accounts”
“Marketing”
“HR”
“”That’s all. Hope you find this helpfull.
-
WSClausParkhoi
AskWoody LoungerHarry,
Yes, this is pretty annoying, isn’t it?
You will have to open the subform in design view and change the names of the controls.
Right click on a control and choose properties. Change the value of the property called Name to what you have typed in the Caption of the corresponding field in your table when you defined it. -
WSClausParkhoi
AskWoody LoungerSorry Mark,
I forgot to tell you that the name frmKunde should be replaced by the name of your form.
If you always want your query to return one record only, then use Chris’ suggestion.
If you want the ability to print all records using the same query as well, then use my suggestion. -
WSClausParkhoi
AskWoody LoungerMultiple users can use a non-split db. You split the db for maintenance and/or performance reasons.
1. You have to establish an easy way (for the end user) to re-establish links from the tables in the back-end db (on the server) to the front-db (normally on the user’s PC) . This is needed when a new version of the front-end is installed and when/if the back-end db is moved. Code in the front-end db should check the links and initiate proper relinking action if neccesary (Check each time the user logs on the front-end db).
2. In addition I like to check that the version of the back-end is OK for the front-end. You might have to change the table structure in the back-end for some reason (after you have realeased it for use). Results may be strange if a user tries to use a new front-end with an old back-end (or vice versa).
3. Linked tables may not be opened as tables in VB ( i.e. you cannot use Seek etc.). Look for help on OpenRecordset.
4. There are special concerns when using db password. Look for help on linked databases and db passwd.Have fun.
-
WSClausParkhoi
AskWoody LoungerOpen your form in design mode and use the toolbox to put a button on the form. When the guide asks you for the action to perform choose report.
When the button has been created show the program code and correct the DoCmd.OpenReport stmt to something like this:DoCmd.OpenReport stDocName, acPreview, , “[YourID]=forms!frmKunde!YourID ”
where YourID is the name of the primary key of the record displayed on the form.
If you have done updates on the form, make sure the record is saved first.
![]() |
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
-
My Simple Word 2010 Macro Is Not Working (Awaiting moderation)
by
mbennett555
8 hours, 2 minutes ago -
Office gets current release
by
Susan Bradley
12 hours, 45 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
1 day, 5 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
13 hours, 48 minutes ago -
Stop the OneDrive defaults
by
CWBillow
1 day, 6 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 day, 16 hours ago -
X Suspends Encrypted DMs
by
Alex5723
1 day, 18 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
1 day, 18 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
1 day, 19 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
1 day, 19 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
1 day, 7 hours ago -
Enabling Secureboot
by
ITguy
1 day, 14 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
2 days, 3 hours ago -
No more rounded corners??
by
CWBillow
1 day, 23 hours ago -
Android 15 and IPV6
by
Win7and10
1 day, 13 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
2 days, 16 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
2 days, 18 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
2 days, 13 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
3 days, 2 hours ago -
May preview updates
by
Susan Bradley
2 days, 13 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
2 days, 5 hours ago -
Just got this pop-up page while browsing
by
Alex5723
2 days, 18 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
2 days, 15 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
1 day, 17 hours ago -
At last – installation of 24H2
by
Botswana12
3 days, 17 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
15 hours, 17 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
4 days, 5 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
2 days, 4 hours ago -
Limited account permission error related to Windows Update
by
gtd12345
4 days, 19 hours ago -
Another test post
by
gtd12345
4 days, 19 hours 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.