New
#11
Is it returning a string at all? What does
Dim x as Integer
x = len(Me![PersonTypeID])
give you?
Is it returning a string at all? What does
Dim x as Integer
x = len(Me![PersonTypeID])
give you?
For a combo box set to allow multiple entries it generates a type mismatch. For a combo box set to allow only 1 entry it works fine. Text length is 6 for setting Member. This is the general situation. Everything woks correctly for single entry and generates the mismatch for multiple entry.
all the best
Hi robertd,
First, I have to say Thank You for introducing me to Multi-value fields and Multi-value combo boxes.
They look like a super idea, but I am finding the implementation a little confusing.
My impression is that using a multi-value field is just a way of avoiding creating another little table in your database - one that would be easy to set up, understand and use. Multi-valued fields seem to be unique to Access and I would avoid using them.
However, if you must...
To get at the data held in the field, you need to use:
Me!comboboxname.Text
which will give you a comma separated list of the values stored in the field.
You can also tell whether each option is selected by using:
Me!comboboxname.Selected(n)
where n is the index for the list. This will return True or False, but I have no idea how you know which index number relates to which value in the list - if you work this out, please let me know.
Note that Me!comboboxname.Value does not seem to return anything useful. It is not Null, but neither does it appear to be a string or a number.
Thanks for this. I have a big meeting tomorrow about the database but I will look at this ASAP
It's been SEVERAL years since I did any Access db programming and design. I do remember that the Wizard was often a helpful tool for things like List and Combo Boxes. No doubt you've been there, but thought I'd throw it out there in case you hadn't.
Good luck with your meeting.
Thanks nbcaldon for the pointer to use the Text rather than Value. This has fixed things. But as I can only access PersonTypeID.Text when that field has control I had to put the code for checking the constancy of it into the On Exit event. That leaves consistency code concerning another field in the routine I posted. As regards the Select function the first item is flagged by n = 0, the next by n = 1 etc. As far as I see things here the order is that which you have in the table that feeds the combo box. However, I have not yet succeeded if getting Selected(n) to return sense. So far I always got False even when I manually selected a value with the cursor. I do not need this as yet but if I get there I will get back to you.
best wishes
This is what I meant for a test:
For n = 0 To 1
MsgBox n & ": " & Me!Combo2.Selected(n)
Next n
Actually returns the numeric 0 or -1, but can be tested for True and False.
Looking a but more into MVFs, I cannot find any documentation to say what the Value property should return. I did find someone saying it returned a recordset, but I could not assign it successfully to a recordset object, so I suspect this might not be correct.
As regards where the data is stored, I have seen mention of hidden tables, but there are no simple hidden tables. It appears that the data is stored in a non-trivial way in the system tables, partly (but not entirely) in 'MSysComplexColumns'.
My recommendation would be that MVFs should only be used for simple applications where the wizards give you what you need and you do not need to get at the data in code. Otherwise, I think it is more manageable to stick to explicit many-to-many join tables and use subforms instead of multi-value combo boxes. I don't expect everyone to agree with this.
OK, I see, thanks. I agree with you about the multi-entry combo box. But the charity specified that they wanted the facility in several fields to multiple entry. As I am not involved in its running or direction and only got involved database wise on a voluntary basis, what they said goes.
Cheers