Access Database Problem

Page 2 of 2 FirstFirst 12

  1. Posts : 355
    Win10 Ver. 1809 Build 17763.`
       #11

    Is it returning a string at all? What does

    Dim x as Integer
    x = len(Me![PersonTypeID])

    give you?
      My Computer


  2. Posts : 24
    Windows 10
    Thread Starter
       #12

    Access database problem


    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
      My Computer


  3. Posts : 16
    Windows 10 V1709
       #13

    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.
      My Computer


  4. Posts : 24
    Windows 10
    Thread Starter
       #14

    Access database problem


    Thanks for this. I have a big meeting tomorrow about the database but I will look at this ASAP
      My Computer


  5. Posts : 1,097
    Windows 10 Home x64 Version 1809 (OS Build 17763.437)
       #15

    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.
      My Computer


  6. Posts : 24
    Windows 10
    Thread Starter
       #16

    Access database problem


    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
      My Computer


  7. Posts : 16
    Windows 10 V1709
       #17

    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.
      My Computer


  8. Posts : 24
    Windows 10
    Thread Starter
       #18

    Access dadabase problem


    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
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:23.
Find Us




Windows 10 Forums