Results 1 to 12 of 12

Thread: Listbox problem

  1. #1
    Join Date
    Nov 2003
    Location
    UK
    Posts
    12

    Unanswered: Listbox problem

    Here's the situation;

    I have a main form on which users can select a magazine title (sorted alphabetically by a query) from a listbox and then click an "edit" button to open a form for editing the record details. Users can also click an "add" button to create a new record. This all works fine.

    I would like the details of the selected magazine title to de displayed on a subform so that users can easily determine whether the selected record requires editing.

    And that's the bit I can't get to work!

    As I'm totally new to Access I don't really know how to get this working!

    FYI, I'm using Access 2002.

    Any help you could offer would be greatly appreciated!

    Regards,

    John

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    See in this forums the topics "subforms, combo box requery problems", that can help to you.
    Saludos
    Norberto

  3. #3
    Join Date
    Nov 2003
    Location
    UK
    Posts
    12
    Perhaps I should also have said that the subform does not appear to be bound to anything! I've tried setting the Master/Child link options but access won't let me! I have no idea how to correct this!

  4. #4
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Originally posted by genisys
    Perhaps I should also have said that the subform does not appear to be bound to anything! I've tried setting the Master/Child link options but access won't let me! I have no idea how to correct this!
    Bueno....... To the Work....
    1) Make a main form with a combo box where the users can select the titles is very importan that this com box store in memory the IdTitlenumber of the title for use later.
    2)Make a Subform in the main form with the data that you wnat to edit and the field IdTitleNumber.
    3)In the subform link the property (LinkChildFields) and (LinkMasterFields) do this:
    LinkMasterFields: (Control Name of combo box) IdTitlesNumber
    LinkChildFields : (Control Name of subform field IdTitlesNumber) IdTitlesNumberSubform.
    4)In the subform set the property AllowAdditions to "No" and the property DataEntry to "No".
    5)In the combo box of the form, in the event after update you must do a requery of the subform, some thing like this:
    Forms![MyMainForm]![MySubform].Requery
    for update the view of the subform when you select titles.
    I hope this can you help.
    Saludos
    Norberto

  5. #5
    Join Date
    Nov 2003
    Posts
    66
    I had the same problem - don't use the build (...) button when you're setting the master/child field properties. Manually type in the names of the fields you want to set yourself. Worked OK for me.

    D

  6. #6
    Join Date
    Nov 2003
    Location
    UK
    Posts
    12

    still got a problem...this time it's the requery!

    The subform is in place. However, it does not display the record for the selected title. When the form is opened I am prompted for a title ID and then this is the record displayed in the subform! It would appear the requery is not being passed the ID to display from the listbox as every time I select a title to display a dialog box pops up asking for a title ID.

    By the way, I am requering in code using;

    Private Sub MyListbox_AfterUpdate()
    Forms!MyForm!MySubform.Requery
    End Sub

    This is bringing me to my knees....

  7. #7
    Join Date
    Nov 2003
    Location
    UK
    Posts
    12
    You were right, daver. I was using the build button but when typed in manually it was fine - no more error message! Now my other problem... (above)

  8. #8
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: still got a problem...this time it's the requery!

    Originally posted by genisys
    The subform is in place. However, it does not display the record for the selected title. When the form is opened I am prompted for a title ID and then this is the record displayed in the subform! It would appear the requery is not being passed the ID to display from the listbox as every time I select a title to display a dialog box pops up asking for a title ID.

    By the way, I am requering in code using;

    Private Sub MyListbox_AfterUpdate()
    Forms!MyForm!MySubform.Requery
    End Sub

    This is bringing me to my knees....
    If you want send me and sample base in Access 97 then i see what is the problem and y send to you with the update. Is more easy this way.
    Saludos
    Norberto

  9. #9
    Join Date
    Nov 2003
    Location
    UK
    Posts
    12

    sample DB

    I have attached a zip file containing the problem form(s). The file contains both a 97 and 2000 format DB. When converting the DB to 97 format I received an error message saying;

    "Your computer is missing at least one of the MS Access 97 object libraries. Your converted database will not work until you open this database using Access 97 and then fix any missing references."

    But I went ahead and converted anyway.

    If you can get the form to work as required I will be extremely grateful!

    Could I ask that you comment any code (or otherwise document any changes) so that I can understand and learn from it so I won't have to bother anyone with questions like this again. I guess it's quite irritating when similar problems keep getting posted!

    Thankyou in advance,

    Regards,

    John
    Attached Files Attached Files

  10. #10
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: sample DB

    Originally posted by genisys
    I have attached a zip file containing the problem form(s). The file contains both a 97 and 2000 format DB. When converting the DB to 97 format I received an error message saying;

    "Your computer is missing at least one of the MS Access 97 object libraries. Your converted database will not work until you open this database using Access 97 and then fix any missing references."

    But I went ahead and converted anyway.

    If you can get the form to work as required I will be extremely grateful!

    Could I ask that you comment any code (or otherwise document any changes) so that I can understand and learn from it so I won't have to bother anyone with questions like this again. I guess it's quite irritating when similar problems keep getting posted!

    Thankyou in advance,

    Regards,

    John
    Now work fine ( in spanish: un chiche ), three mistake:
    1) In LinkMasterFields and LinkChildFields.
    2) In the event after update of the control list
    3) I create a new field not visible in the form (SelectJournalList) for use in LinkMasterFields, because you use and list box then i must do reference with the column(0) of the list box.
    See the Change.
    Attached Files Attached Files
    Saludos
    Norberto

  11. #11
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Sorry i forget some thing:
    Set the property visible to "No" for the control SelectJournalList ( 3) I create a new field not visible in the form (SelectJournalList) ).
    Saludos
    Norberto

  12. #12
    Join Date
    Nov 2003
    Location
    UK
    Posts
    12

    Talking

    Originally posted by Norberto
    Sorry i forget some thing:
    Set the property visible to "No" for the control SelectJournalList ( 3) I create a new field not visible in the form (SelectJournalList) ).
    Already done it...

    Thanks for all your help, it now works perfectly! I didn't realise you had to use an extra textbox to contain the ID for the subform to use! Would NEVER have got it functioning without your help.

    Am forever in your debt.

    Regards,

    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •