UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Combo Box Values?, Access 2010    
 
   
ronehrlich
post Aug 17 2019, 02:32 PM
Post#1



Posts: 49
Joined: 18-April 09



Hello all. Please help with the VBA code as follows: I have a form that contains ten combo boxes. The boxes are named fw1,fw2, … fw10. What would be efficient VBA code to extract the value contained in each combo box? Thanks in advance. Best regards, Ron in Rochester
Go to the top of the page
 
tina t
post Aug 17 2019, 02:37 PM
Post#2



Posts: 6,075
Joined: 11-November 10
From: SoCal, USA


QUOTE
What would be efficient VBA code to extract the value contained in each combo box?

and do what with the values? i mean, do you want to write the values to a table? or add them together? or...?

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 
ronehrlich
post Aug 17 2019, 02:58 PM
Post#3



Posts: 49
Joined: 18-April 09



Write them to a table. The user does not have to make a selection in each of the ten combo boxes, but could if necessary.
Go to the top of the page
 
GroverParkGeorge
post Aug 17 2019, 04:29 PM
Post#4


UA Admin
Posts: 35,683
Joined: 20-June 02
From: Newcastle, WA


Unfortunately, the description of the problem seems to suggest an inappropriate table design behind those 10 combo boxes. So, in addition to addressing tina's question, I'd like to be sure we're on the right track with table design to begin with.

Please tell us what is in those controls: "The boxes are named fw1,fw2, … fw10"

Thanks for giving us enough information to figure out how to help.

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
ronehrlich
post Aug 18 2019, 07:16 AM
Post#5



Posts: 49
Joined: 18-April 09



I will try to unravel two of my discussion posts to answer your question regarding table design. There is an existing access table of 700+ records, and each record contains a memo field of length 300+ text characters. The user will use one or more combo boxes(max 10) to build a set of words, and that set of words will be used to find those records where the memo field contains the set of words. Then the user will be shown those records. The reason we need multiple combo boxes is that each combo box cannot be combined with any other combo box on the form. I guess I know the final objective
but I am having trouble expressing the steps of the process. So let us say that the user picks a set of 3 words: fish, train, ladder. Then the VBA program will search all the memo fields in all the records in the table, and shows the user which records have the set. Note that all the words in the set must be found in one memo field, but each word can be anywhere in the memo field
This post has been edited by ronehrlich: Aug 18 2019, 07:58 AM
Go to the top of the page
 
GroverParkGeorge
post Aug 18 2019, 11:14 AM
Post#6


UA Admin
Posts: 35,683
Joined: 20-June 02
From: Newcastle, WA


Okay, thanks for clarifying.

So, in order to use combo boxes here, you'll have to supply values in the row source for each combo box. Do you already know the domain of search terms you'll use in each combo box? Is each combo box set up to use the same domain of search terms? In other words, all you need to use is select any combination of 1 to 10 words from identical lists of words? If so, how do you decide what words qualify to be searched? Are you looking for keywords that you already know?

Given that situation, and assuming that the 10 combo boxes have identical row sources, I'd suggest you change to a single Multi-Select List box instead. Then, you can concatenate the selected items into a search string. Would that not work here?

Again, there's a sample of using a multi-select list box in the demo db to which I previously linked.

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
RJD
post Aug 18 2019, 01:20 PM
Post#7


UtterAccess VIP
Posts: 10,028
Joined: 25-October 10
From: Gulf South USA


Hi: Pardon me for jumping in, but I wanted to bring up an issue often encountered in searching for words in a string. That issue is when you are searching for a stand-alone word in the midst of a string, e.g. " the " when using *the*, when other words may also contain those letters in succession, yet not be the stand-alone word, e.g. "another", and thus not wanted.

This can be worked around by adding a space before and after the search term, and accommodating this with spaces around the searched field as well.

See the demo attached. In this demo, I used another approach to this search, using multiple Like criteria in a query, with no VBA required, and recognizing the stand-alone word issue in the SQL.

The demo assumes, as George indicated, that you will have a list of search words in a table, feeding the comboboxes. If this is to be "free entry," then the comboboxes should become just textboxes for the user to enter whatever is desired.

Certainly, you will want to look at George's example and see which approach fits your needs and skill level. And, no doubt, there are other approaches as well (as usual in Access!).

HTH
Joe
Attached File(s)
Attached File  ComboBoxValues.zip ( 31.4K )Number of downloads: 2
 

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
dale.fye
post Aug 18 2019, 01:48 PM
Post#8



Posts: 160
Joined: 28-March 18
From: Virginia


You may have seen my answer to another question.

I wrote an article on "Complex Text Filters" a number of years ago. You might want to check that out and take a look at the database that is associated with it, then reconsider the use of combo boxes to build the query.

--------------------
Dale Fye
Microsoft Access MVP 2013-2016
Developing Solutions, LLC
Go to the top of the page
 
GroverParkGeorge
post Aug 19 2019, 09:55 AM
Post#9


UA Admin
Posts: 35,683
Joined: 20-June 02
From: Newcastle, WA


One of the strengths of Access is that it supports a wide variety of methods to achieve most results.

One of the difficulties of working with Access is that it offers a wide variety of methods to achieve most results. Sometimes that range of alternatives makes picking and implementing one in your OWN relational database application challenging.


--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    20th September 2019 - 11:47 PM