Results 1 to 7 of 7
  1. #1
    RedCatuday is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    3

    capture value of an undefined column value of a combobox

    Hello.


    I'm not so familiar with proper terms so i'll define it as layman as i could.

    I have a combobox using itemID as bound field but itemDescription as displayed field.
    incidentally, i have a NotInList event which would open another form(frmMaterials) in order to add the unlisted material into the table.

    on this event, i want to capture the value already typed in the combobox as an openarg and pass it into frmMaterials so the user won't have to retype it again.
    the problem is, i don't know how to reference the value in the combobox as me.itemID.value doesn't work.

    i've tried me.itemid.column(1) just for kicks though i was certain it won't work as well.

    Kindly point me to the correct direction if this is possible. thanks

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    If the entry has not been saved there might be no value property value; you might have to use the text property value instead. However, why open another form to add a value when you can simply save the combo entry as a new record? If you found code for this event but it didn't show you how to simply add the data that was entered into the combo, then you might want to find and copy such code, unless...

    If there are more details that need to be added for this new record then you probably should post the code because referring to a column to get a value should work. Alternatively, put a break on the start of the code and step through and check the values by mousing over their references (after the line has been executed) - or use Debug.Print and view the result in the immediate window, as in

    Debug.Print Me.Itemid.Column(1)

    If you post the event code, please paste between code tags (use # on posting toolbar).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    RedCatuday is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    3
    you're probably right that it's not saving per se. I tried it with combobox with only a single column and it returns as null.

    To explain further, i need to open another form because it has a few more fields that must be added; afterall, the field is itemID only.
    I haven't found anything to help me with this, perhaps i'm using the wrong search key words.
    i was just pondering on it since normally, a textbox or combobox can pass its value to another via openargs or simply referencing it from another form.

    do you think there's something between access comparing the value in the combobox and telling you it's not among the list?
    before it triggers the NotOnList event, it should at least define the value that isn't listed. is that somehow stored?

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    At this point, I think I can only continue to help if you post the code (and that's a maybe) or copy the db, compact and zip it and post it here. You can remove whatever is not required to replicate the issue. Or look here at the "bound combo box" code example

    https://docs.microsoft.com/en-us/off...obox.notinlist
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    @RedCatuday

    Perhaps you could use the NotInList event to ask the user for confirmation that the new item should be added. Then add the item to the table. Then use DLookup() to return the PrimaryID value. Finally, open a form filtered by the PrimaryID value where the user can fill any other data fields. I have attached a simple example.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Here's another example with 3 different methods for the not in list event.
    A standard NIL, A NIL with a form, And a NIL with a spellcheck.
    Attached Files Attached Files
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #7
    RedCatuday is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    3
    Quote Originally Posted by Micron View Post
    At this point, I think I can only continue to help if you post the code (and that's a maybe) or copy the db, compact and zip it and post it here. You can remove whatever is not required to replicate the issue. Or look here at the "bound combo box" code example

    https://docs.microsoft.com/en-us/off...obox.notinlist
    Micron, thanks for including that link. I studied it and i was actually way off on what i thought of NotInList event.

    Quote Originally Posted by Bob Fitz View Post
    @RedCatuday

    Perhaps you could use the NotInList event to ask the user for confirmation that the new item should be added. Then add the item to the table. Then use DLookup() to return the PrimaryID value. Finally, open a form filtered by the PrimaryID value where the user can fill any other data fields. I have attached a simple example.
    Thanks Bob for your example, I modified your code a bit to add itemID and it worked as i needed it to.

    Quote Originally Posted by moke123 View Post
    Here's another example with 3 different methods for the not in list event.
    A standard NIL, A NIL with a form, And a NIL with a spellcheck.
    'I'll keep this until I can understand it. I was definitely enthused with the spellcheck. thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 03-09-2020, 10:10 AM
  2. Two-Column Combobox
    By dotcanada in forum Access
    Replies: 1
    Last Post: 10-06-2016, 08:32 AM
  3. Replies: 3
    Last Post: 03-02-2015, 09:50 AM
  4. Replies: 1
    Last Post: 01-16-2015, 09:28 AM
  5. Combobox Column()
    By tcheck in forum Access
    Replies: 3
    Last Post: 08-08-2013, 08:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums