Page 1 of 3 123 LastLast
Results 1 to 15 of 34
  1. #1
    ngahm is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    17

    Write "Edit List Items.." data back to original form.


    This should be easy, but I have not been able to figure it out. I have created a data entry form with several fields that are foreign keys linked to primary keys in appropriate information tables. I have succesfully linked to the various table and displayed information fields (rather than key numbers) in comboboxes in the data entry form. This works perfectly to lookup and enter the proper value from the appropriate table.

    If the value is not in the appropriate table, I have successfully created the ability go to a data entry form for that "appropriate table" (by right clicking the combobox and selecting "Edit List Items...") and enter the new value. Now, here is my problem; when I close the "Edit List Items.." form and return to the original data entry form, I would like to have the field, in the combbox of the original data entry form, populated by the newly entered data. This is what I think should be easy, but I have not been successful. Any help would be appreciated. Thank you.

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    OnClose - Forms!formname!comboboxname.requery

    If this doesn't work then maybe the new data hasn't been saved yet. You may need this:
    If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord

  3. #3
    ngahm is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    17
    Thank you, aytee11, for your prompt respone. I entered "Forms!formname!comboboxname.requery" (with appropriate formname and comboboxname substitutions) in the OnClose option of the lookup form as a VB expression and get the following: "error '438' Object doesn't support this property or method". I also tried it as expression with the Expression Builder, and it did not work. What am I doing wrong?

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The form is open, I presume?

  5. #5
    ngahm is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    17
    Yes, it is.

  6. #6
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Try putting it in the form's AfterUpdate.

    Or close the original form and OnClose re-open it.

    Sorry, I thought this would be a simple one!

  7. #7
    ngahm is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    17
    Putting Expression in AfterUpdate gives same error message as when expression is in OnClose. Closing form and then reopening it does not work either.

    Although we have not yet come up with an answer, I appreciate your help.

  8. #8
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I'm trying to mess around with something, but no luck so far. Maybe you should start another thread with a slightly different subject, maybe someone cleverer will know the answer!

  9. #9
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Closing and reopening the form worked for me. When I opened form 2 I closed form 1, then when I closed form 2 I opened form 1 and the new value was in the combo box.

  10. #10
    ngahm is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    17
    Hello again aytee11:
    If it helps, the foreign key in the original form refers to a lookup query so that the field in the form (and in the dropdown box) displays the field information rather than the key number.

  11. #11
    ngahm is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    17
    That's "record information field" not "field information".

  12. #12
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Here's one - OnMouseDown of the combox box put Me!ComboxBox.Requery.

    i don't know how a user will be accessing the field, however, this works when I click on the down arrow. If they just start typing in the box you may have to do something else.

  13. #13
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I have to admit I don't use table lookup fields, I prefer to control the querying myself.

    Old programmer!

  14. #14
    ngahm is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    17
    I presume the OnMouseDown statement goes in the lookup form not the original form. If that's correct, nothing happened.

  15. #15
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    No, the original form. So that it requeries itself as soon as you click on the down arrow.

    I wasn't bothering with the second form, I was adding records to a table manually and then trying out the combo box. I was just going through all of the events to find one that would work!

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 17
    Last Post: 06-04-2012, 05:11 PM
  2. Replies: 13
    Last Post: 01-11-2012, 09:44 PM
  3. Replies: 3
    Last Post: 03-07-2011, 08:37 PM
  4. Replies: 1
    Last Post: 03-26-2010, 07:20 PM
  5. Generate a List of Items from "Many" Relationship
    By Hammer Mark in forum Reports
    Replies: 0
    Last Post: 04-20-2009, 07:30 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