-
WSStewart
AskWoody LoungerI only have access 97 loaded on my PC so couldn’t look at your database, but have tried to provide you with an answer anyway.
Look at the following code.
Private Sub butBuildFilter_Click() Dim ctl As Control Dim varItm As Variant Dim MyCriteria As String Dim ArgCount As Integer 'initialise values MyCriteria = "" ArgCount = 0 Set ctl = lstData For Each varItm In ctl.ItemsSelected If Not ArgCount = 0 Then ' previous items have been added to the list 'Substitute your field name for the word FIELDNAME MyCriteria = MyCriteria & " or [Fieldname] = '" _ & ctl.ItemData(varItm) & "'" ArgCount = ArgCount + 1 Else 'Substitute your field name for the word FIELDNAME MyCriteria = "[Fieldname] = '" _ & ctl.ItemData(varItm) & "'" 'first item added. ArgCount = ArgCount + 1 End If Next varItm 'you now have a where clause that you can use to 'open a report, form etc, or add to a SQL 'string for whatever use. Or a string that you can 'use as a filter. MsgBox MyCriteria End Sub
Your hyperlink asking if I’m the same Stewart Tanner doesn’t go anywhere, so I can’t answer that.
Edited by Charlotte to eliminate horizontal scrolling
-
WSStewart
AskWoody LoungerI don’t have access 2000 but the 97 method would be something like this.
(straight from the help)The following example prints the value of the bound column for each selected row in a Names list box on a Contacts form. To try this example, create the list box and set its BoundColumn property as desired and its MultiSelect property to Simple or Extended. Switch to Form view, select several rows in the list box, and run the following code:
Sub BoundData()
Dim frm As Form, ctl As Control
Dim varItm As VariantSet frm = Forms!Contacts
Set ctl = frm!Names
For Each varItm In ctl.ItemsSelected
Debug.Print ctl.ItemData(varItm)
Next varItm
End Sub -
WSStewart
AskWoody LoungerSeptember 6, 2001 at 12:32 am in reply to: Can I Use One Form For Different Queries? And More (97) #540876I’m glad you worked it out. I’ve been off work so hadn’t seen your posts. Sorry for the delay in responding.
Use of the parameters in a query is exactly what I did but the paramater was pointing to the field on the menu, rather than asking for the value to be entered.
-
WSStewart
AskWoody LoungerYou can build an expression in a query. Use the syntax
ObjectionNumber: [ObjectorID] & “-” & [ObjectionID] & “/” & [PlanField]
where objectorID = 10, ObjectionID = 0001 and PlanField = AZ324 this expression would return
10-0001/AZ324or
ObjectionNumber: [ObjectorID] & [ObjectionID] & [PlanField]
where objectorID = 10, ObjectionID = 0001 and PlanField = AZ324 this expression would return
100001AZ324The expression wil have the name/label “ObjectionNumber”. The colon ends the naiming section.
Each field that you want can be concatenated by using the ampersand “&” between fields. To add formating characters between fields (if required) use the ampersand with the character emclosed in double quotes.
-
WSStewart
AskWoody LoungerWhat help in particular are you looking for? Table Design, Query?
-
WSStewart
AskWoody LoungerUm, have you tried the obvious? delete one of the fields and re create it. Does it now work?
Check that there is not a conflict between field name and control name.
If it works perfectly in another form the implication is that you have performed a cut and paste without completing customisation of the copy.
-
WSStewart
AskWoody LoungerUse a combo box for the control with the rowsource based on a distinct list of previously enetered values.
-
WSStewart
AskWoody LoungerAugust 29, 2001 at 2:35 am in reply to: Can I Use One Form For Different Queries? And More (97) #539574on the main menu change the rowsource for the combo box from
SELECT DISTINCTROW [Problems].[Chapter] FROM [Problems];
to
SELECT DISTINCT [Problems].[Chapter] FROM [Problems];
This will give you 1 instance of 1 and 1 instance of 3 etc.
Glad to help.
-
WSStewart
AskWoody LoungerAugust 28, 2001 at 9:46 pm in reply to: Can I Use One Form For Different Queries? And More (97) #539522I’ve deleted your forms and replaced them with a single form called generic. I’ve added a new table called menu options. In the table add the form description, ( i’ve added you existing forms) and the query you wish the form to be based on.
There is a new form called menu, ope it and see the options available to you. Select the form from the list box. Optionally select the Chapter from existing entries in the table, type a new chapter number if it doesn’t exist, or leave the chapter blank to view all.
Click the open form button.
Hope this helps
-
WSStewart
AskWoody Loungerwhat about using
Amount: Format(nz([SumOfAmount],0),”””A$””0.00″)
where A$ is for Aussie Dollars. I’m sorry I don’t know what the symbol is for Israeli Shekels.
-
WSStewart
AskWoody Lounger“select distinct” in your query to remove the duplicate entries.
or
‘select the report
DoCmd.SelectObject acReport, stDocName, True
‘Print the first page
DoCmd.PrintOut , 1, 1 -
WSStewart
AskWoody LoungerNow i’m confused, I assumed that the primary purpose of this was to create a graphical represenation of the sumary data. Now I’m starting to think that you are using this as a supporting represenation within another report. Is this correct?
If you are looking to show the 5 lines as a primative bar chart in the report header or footer, why not create the report based on the summary graph and just insert it as a subreport? This has the advantage that you don’t need to add new text boxes or anything else via vba if the number of records reurned by the query increases.
-
WSStewart
AskWoody LoungerYour welcome.
Also when I make SumOf Amount with the -nz- function the special format that
I had for the amount, that showed the sign for Israeli Shekels got lost. I
tried pasting it in the format several times but it doesn’t seem to want to
register it. I just re-checked yours and the SumOfAmount also lost its $
sign.Change the format in the field properties to currency, or the format of the field in the form/report.
-
WSStewart
AskWoody LoungerAlternately you can add a parameter to the query under the date field eg
forms!MySummaryForm!cboSelectMonth. Then when you have changed the date in
the combo box you can requery the control/subform etc that is displaying the
query output to obtain the correct value.I didn’t quite understand this… I am a real NEWBIE and need IDIOT
language.Have alook at query 3 in attached. Run it from the form using the command button, not Idiot language, just something that you can understand. Don’t worry we were all beginners once.
it would be nice
if they would come up as $0.00… but maybe I am asking to muchIt is not to much to ask. Query 2 or 3 do this. Look at the Amount field. The NZ function is wonderful.
-
WSStewart
AskWoody Loungerrather than
NewJobno = NZ( DMax(“jobno”,”tblJobs”,”jobDate=” & txtDate),0) + 1
Use
NewJobno = NZ( DMax(“jobno”,”tblJobs”,”jobDate=#” & format(txtDate,”mm/dd/yyyy”) & “#”),0) + 1
The # tells access that it is a date value. The format forces american date format as that is what VBA understands.
After all the american date format is standard all accross the world, sarcasm off now.
![]() |
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
-
Windows 11 24H2 Default Apps stuck on Edge and Adobe Photoshop
by
MikeBravo
7 minutes ago -
North Face and Cartier customer data stolen in cyber attacks
by
Alex5723
32 minutes ago -
What is wrong with simple approach?
by
WSSpoke36
2 hours, 7 minutes ago -
Microsoft-Backed Builder.ai Set for Bankruptcy After Cash Seized
by
Alex5723
8 hours, 36 minutes ago -
Location, location, location
by
Susan Bradley
20 minutes ago -
Cannot get a task to run a restore point
by
CWBillow
10 hours, 2 minutes ago -
Frustrating search behavior with Outlook
by
MrJimPhelps
46 minutes ago -
June 2025 Office non-Security Updates
by
PKCano
20 hours, 47 minutes ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
2 hours, 51 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
20 hours, 43 minutes ago -
How start headers and page numbers on page 3?
by
Davidhs
1 day, 7 hours ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
9 hours, 49 minutes ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
1 day, 15 hours ago -
Windows 11 Insider Preview build 26120.4230 (24H2) released to BETA
by
joep517
1 day, 15 hours ago -
MS Excel 2019 Now Prompts to Back Up With OneDrive
by
lmacri
1 day, 5 hours ago -
Firefox 139
by
Charlie
22 hours, 6 minutes ago -
Who knows what?
by
Will Fastie
29 minutes ago -
My top ten underappreciated features in Office
by
Peter Deegan
1 day, 16 hours ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
1 day, 10 hours ago -
Misbehaving devices
by
Susan Bradley
12 hours, 16 minutes ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
2 days, 22 hours ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
1 hour, 9 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
2 days, 21 hours ago -
Discover the Best AI Tools for Everything
by
Alex5723
1 day, 20 hours ago -
Edge Seems To Be Gaining Weight
by
bbearren
2 days, 11 hours ago -
Rufus is available from the MSFT Store
by
PL1
2 days, 19 hours ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
3 days, 22 hours ago -
KB5061768 update for Intel vPro processor
by
drmark
1 day, 22 hours ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
1 day, 20 hours ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
3 days, 18 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.