Results 1 to 11 of 11
  1. #1
    Join Date
    Aug 2004
    Posts
    364

    Unanswered: How to Filter a Textbox based on a combobox - from a continuous form

    How do I filter a textbox on a form based on the value of a combobox in a subform.

    The value of the combobox in the subform which is to to filter into the textbox on the form must be taken from the newest (or last) record in that subform.

    The subform Default View is set to Continuous Forms so if there are ten records in the subform, there will be ten comboboxes in the subform. I need the value of the final combobox.

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    It means that your textbox is UNBOUND.
    In that case I put textbox in the FORM FOOTER.
    Look at "DemoSubDateA2002.mdb" (attachment zip).
    Combo box "f1id2" in "frmSubform", and a textbox in
    the form footer "f2Name" (Text4 field).
    Open "frmMain" and try.
    Attached Files Attached Files

  3. #3
    Join Date
    Aug 2004
    Posts
    364
    Hello, I cannot open the ZIP file, message says it is corrupted. I had the same problem a few weeks back when I tried uploading a database inside a zip file. Any chance you could upload it somewhere else or try again?

    The textbox on my form, is bound to a field in a table by the way.

  4. #4
    Join Date
    Aug 2004
    Posts
    364
    Ok I have got the database open.

    The textbox needs to be on the form, not the subform, and the last record on the subform combobox will provide the information to be put in the textbox on the form.

  5. #5
    Join Date
    Aug 2004
    Posts
    364
    All I want to do is display the last value of a field of a table from my subform (set to continuous form) in a textbox on the mainform.

    The records in the subform have a primary key field (e.g. 001, 002, 003) etc , so it is field 'FieldName3' from the last record (called say '003') which I want to display in the textbox on the main form.

    When a new record is added (called say record '4') the textbox on the main form will display the last record from FieldName3 still, but this time it will be for record number '4' and so on..
    Last edited by moss2076; 06-16-10 at 17:45.

  6. #6
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    I don't understand what do you want really.
    Send a short example of your MDB, (access 2000, 2002-2003, ziped),
    and explain, what do you want really.

  7. #7
    Join Date
    Aug 2004
    Posts
    364
    I want to take from my subform, the last record of a particular field, and then display that last record in a textbox on my main form.

    I have uploaded a database here, just load the form called 'frmItems'.

    The subform called 'frmItemLocations' has a field called 'LocationName', the location is Location4 for the first record. I want 'Location4' to be displayed in the textbox called 'txtLocatons' at the top of the the master from called 'frmItems'.

    Then when you switch to the next record (there are only 2) the last location name is 'location2', so then I would like location2 to be displayed in the textbox.

  8. #8
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Not "here" send a short example on the forum.

  9. #9
    Join Date
    Aug 2004
    Posts
    364
    I've attached it to this post. It is easier for me to upload it as sometimes the attachments become corrupted in this forum for some reason, but see if you can open the zip file.
    Attached Files Attached Files
    Last edited by moss2076; 06-17-10 at 06:21.

  10. #10
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Here it is "Inventory.mdb" (attachment zip).
    Look at "Query2" (new query).
    Look at "frmItems" (the field "txtLocationName).
    Look at VBA in "frmItemLocations".
    I think it is what you want.
    Attached Files Attached Files

  11. #11
    Join Date
    Aug 2004
    Posts
    364
    Thankyou you have sorted it, it looks really simple once I view the query! Thankyou very much for all your help

Posting Permissions

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