473,406 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Macro/VBA for selecting a value from a bound combobox

I'm currently using an asset database that had been started in the "Asset tracking" template. This template automatically makes a relationship between the assets and contacts in the form of an owner/owned assets.

I've made a query from the assets table that includes: item name, description (for ID number), category of asset, and owner. From that query, I've generated a split form and am now attempting to write a macro (or VBA code, whichever I find works best.) for a search bar that assigns a set owner after the search has been made. The current macro is as follows:

OnClick

ApplyFilter
Where Condition = [Description] Like "*" & [Forms]![Asset Assignment]![assignmentsearchbox] & "*"

GoToControl
Control Name = [Owner]

SetValue
Item = [Forms]![Asset Assignment]![Owner]
Expression = [New Owner Assignment]


This will correctly search and change the Owner field, however since the Owner field is bound to a contact, it does not correctly assign this new owner and returns this error message:

The value you have entered isn't valid for this field
For example, you may have entered text in a numeric field or a number that is larger than the FieldSize setting permits.

I'm assuming this is because the asset sheet sees the owner name from the contacts as an associated number with that name.

Is there any way that I can possibly search within the [Owner] combobox with an if statement similar to if[Owner]=![New Owner Assignment]?

I would like to keep this all in one click because it is being used for a barcode scanner.
Thanks!
Jul 26 '16 #1
1 777
I've solved a chunk of the problem, and asked an updated question.

https://bytes.com/topic/access/answe...ro#post3805038
Jul 26 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Aaron Ackerman | last post by:
I have a bound combobox the appears on a cell within the column of my bound grid when the user clicks on a cell n(In my vb.net WinForm app). I am trying to allow the adding of an item to that bound...
2
by: Crazy Cat | last post by:
I am using a data-bound combobox with dropdownstyle set to dropdownlist. Teh combobox is bound to a bindingsource which is in turn bound to a table in my database. The table has only 4 rows and I...
2
by: Rob R. Ainscough | last post by:
I know I must be going crazy, but for the life of me I can't figure out why IndexOf is always returning -1? With MyComboBox .ValueMember = "Field1" .DisplayMember = "Field2" .DataSource =...
4
by: reidarT | last post by:
I want to get the text from a bound combobox in a variable I try to use strVar = me.cboName.SelectedText.Tostring, but it doesn't work. reidarT
0
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number...
3
by: greeknl via AccessMonster.com | last post by:
Is possible to save to a variable in VBA the value a combobox had before it was updated in order to use it because the update value can be retrieved easily Thank you -- Message posted via...
3
by: haanjae | last post by:
I want to send a private message to particular client by selecting number in comboBox. but had tried to code it but message still receive at every clients that connected to server. i want to send the...
0
by: PaulMijnster | last post by:
Hi, Beginning to learn Visual Basic 10. Experienced user of VB 6 it now is time to learn the modern approach... Case: Table 'Customer' in SQL Server, Fields are 'Name' and 'Adress' VB...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.