Results 1 to 11 of 11
  1. #1
    sara88m is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2017
    Posts
    6

    related combo boxes

    hello guys
    I have a problem in my database
    I have a table with 12 fields 3 of which are combo boxes
    I designed a form and wrote code (after update event) to relate the 3 combo boxes
    now, when I fill a record and click on enter to go to the next record, the 3 combo boxes of the new record is auto filed based on the previous record!
    in this way I can have the same data in the 3 combo boxes for all my records.


    Anyone can help me??

  2. #2
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Put this in the code for the "enter". Change the names to suit.

    Me.Combobox1 = Null
    Me.Combobox2 = Null
    Me.Refresh

  3. #3
    sara88m is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2017
    Posts
    6

    where

    thanks dear Homegrownandy
    on which field should I add this code? you mean on "on enter" in the properties of that field?

  4. #4
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    you said " click on enter to go to the next record" I assumed you created a command button that did something. Is that correct?

  5. #5
    sara88m is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2017
    Posts
    6
    actually I want to be able to go to a new record. with a button or by clicking on enter key, after I fill the last field of the record. the both are OK.

  6. #6
    sara88m is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2017
    Posts
    6
    Your command makes the very data of that record Null/empty, doesn't make a new empty record for me to enter the data of the next record..

  7. #7
    sara88m is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2017
    Posts
    6
    Your command makes the very data of that record Null/empty, doesn't make a new empty record for me to enter the data of the next record..

  8. #8
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    create a button that you will press when you have finished data entry. You can apply some validation to your data here so you get what you want. you can save the record and open a new one. you can refresh combo boxes. whatever you want.

    you said : "now, when I fill a record and click on enter to go to the next record, the 3 combo boxes of the new record is auto filed based on the previous record" so the code I provided will clear those entries.

  9. #9
    sara88m is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2017
    Posts
    6
    Thank you dear friend
    I said that in a case that I do data entry in rows in one form without a button. with a button, I tried your code but made the very record empty, would you please help me with the both methods ? or either which you can

  10. #10
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    this will close the form you're on and reopen it. If your textboxes /combo boxes are bound then the record will save.

    DoCmd.Close acForm, "your form name"
    DoCmd.OpenForm "your form name",,,,acFormAdd

    See how that works.

  11. #11
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by sara88m View Post
    <snip>I have a table with 12 fields 3 of which are combo boxes<snip>
    It sounds to me like you have 3 lookup FIELDS in the table. Bad idea......
    See
    The Evils of Lookup Fields in Tables
    http://access.mvps.org/access/lookupfields.htm

    Also
    The Ten Commandments of Access
    http://access.mvps.org/access/tencommandments.htm


    The combo boxes should be controls on a form......

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

Similar Threads

  1. combo boxes , query, related report
    By lambert in forum Reports
    Replies: 9
    Last Post: 06-17-2014, 02:04 PM
  2. Replies: 11
    Last Post: 08-22-2012, 06:34 AM
  3. Related Combo Boxes
    By Opid in forum Access
    Replies: 4
    Last Post: 06-22-2012, 09:08 AM
  4. Two related combo boxes in a form?
    By Aleksandra in forum Forms
    Replies: 2
    Last Post: 03-25-2012, 09:44 AM
  5. Related Combo Boxes
    By Michael T in forum Forms
    Replies: 14
    Last Post: 11-23-2011, 10:39 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