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!