Results 1 to 6 of 6
  1. #1
    raffi is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    Inside a Sub Procedure
    Posts
    88

    Auto Add new Value through a combo-box

    hello i created a data entry form where it has a PO# combo-box the reason i turned it into a combo box cuz i have a table where i need to store all the PO's so later i can turn it into a main form with the data entry other info as sub form, ok i need to see if its possible to auto add a new value trough a combo-box into its table, or if i can create a form and a load event maybe where it will add the value and save and close through the combo-box



    now i know there's the list item edit form in the property but i need to check if theres any shortcut way quickly adding to its table while im doing data entry.

    thank you

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Explore the combobox NotInList event.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    raffi is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    Inside a Sub Procedure
    Posts
    88
    alright i created a form out of the PO table and i set a text field and a button in the data entry form within the button i added the event,

    Code:
    SetTempVar
    
    name : VarAddFromTxtField
    Expression : [ the txt field name here ]
    
    open form
    
    form name : [ Form of PO table ]
    
    data mode : add
    
    closewindow
    and within the PO form i created a load event

    Code:
    setproperty
    
    control name : the PO Number Field here
    
    property : value
    
    value : =[tempvars]![VarAddFromTxtField]
    and now whatever number i add in the in the txt box and click on the button it auto adds that number into the PO table, lol and theres another combobox in the same form where i can choose the newly created PO number....

    lol its not exactly how i imagined would be like .. well its just slightly tiny bit faster then switching forms

    and once again thanks! =]

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    That isn't using the NotInList event of combobox.

    I don't use macros, only VBA.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    raffi is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    Inside a Sub Procedure
    Posts
    88
    well i got a lot of learning to do in vba the only reason why i ended up using temp var is cuz my vba skills are low o well must learrnnnn but thx anyway for pointing me to the right direction

    and i discovered theres a downside, if i click the button twice it will add the same PO number twice =l lol got to be careful now heh.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Code could check if the PO is already in the table. I think macro could use a DLookup for that along with an If Then.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. open image file trough a button in form
    By raffi in forum Forms
    Replies: 3
    Last Post: 09-23-2014, 02:49 PM
  2. Loop trough listbox to update table
    By mari_hitz in forum Programming
    Replies: 4
    Last Post: 04-21-2014, 07:16 AM
  3. Query Filter Trough ComboBox
    By Dinjyo65 in forum Queries
    Replies: 5
    Last Post: 07-16-2012, 11:43 AM
  4. Replies: 3
    Last Post: 11-04-2011, 01:50 PM
  5. Replies: 1
    Last Post: 09-19-2009, 09:37 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