Avatar of Alphacircuits
 asked on

Using a list box / combo box to hold a static value on a form.

I have a form I am using to load values in a table. I need the ability to select a value in a list or combo box (which is pulling from another table) and have that value remain static for multiple entries until changed instead of resetting with each entry. How might one go about this?
Microsoft Access

Avatar of undefined
Last Comment
Jeffrey Coachman

8/22/2022 - Mon
Jeffrey Coachman

<and have that value remain static for multiple entries until changed instead of resetting with each entry.>

Can you walk us through a step-by-step, real world user scenario of what you ultimately need?

This database is being used to scan asset tags. I have a form that works great for adding records if your sitting at the desk but there are occasion when my guys need to scan ( with a wireless scanner) multiple asset tags and it is inefficient to go back and forth between scans to select the 'Category' from a drop down list.

What I am trying to do is create another form that will allow us to select a value from a drop down list E.G. "Laptop" and retain that value while we scan multiple laptop asset tags.

Does that help?
Jeffrey Coachman

Thanks for the clarification.

Not knowing how your app designates each separate "Scan", ...My guess would be to create a Global/Pubic variable that the Scanning app would look at instead of the combo box.

So the user might have to click a button that says "Multiple Scans", and set off code to load the variable and point the app logic to the variable instead of the combobox.

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck

There is not a separate scanning app. I am just using a scanner to input values into an access form.
With each record that is added all fields on the form clear and you start again. I just want to be able to create a 'default value' that can be changed periodically using a drop down list.

Jeffrey Coachman

<"There is not a separate scanning app.">
There must be something, ...AFAIK you can't just create a form, hook up a scanner and do what you are describing...

In any event, what I posted as a "framework" should work.

The code would read this value and insert into the appropriate field.
Create an *unbound* combobox (this should be unaffected by the "clear and you start again" that the scanner performs), then use code like this to insert the value into the appropriate field:

Again, I don't know the details of how the scanner interacts with MS Access (how it initiates a new record, how it decides a record is "finished"...etc)

But again as a framework, this seems like a plan to me.
(can you post the relevant code from the form?)

OK, there is not a separate app, and the scanner is not making any decisions. It is just scanning a bar code and is programed to 'ENTER' after each scan.

Think of it like this. I have a form with one bound textbox called Asset#. I type in a tag #, hit enter, the record is added to the assets table and the textbox is now blank awaiting the next entry. Very generic...

The assets table does have many other attributes, but for this purpose I just want the asset # and a category. So as you have pointed out, without some special app that allows me to select values using a scanner, I can not associate a category with each asset#. So, I want to be able to set the category on the form and have that category I selected added to the asset table with each scan.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jeffrey Coachman

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Thanks, sorry for the confusion. I am by no means an expert so I had a little but of a hard time correctly articulating my needs.
Jeffrey Coachman

ok, glad I could help