Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    You don't need to extra query, in the control source for the reversed text textbox just add the custom function like in the query field.



    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  2. #17
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Quote Originally Posted by Ajax View Post
    point is - the subform part is a datasheet - so only the current record would show the last line using setfocus, not all the lines. And as previously stated, with a split form, you cannot use code to impact only the subform part or visa versa.
    I'll give you some of that for sure, but I can tell you it does work on the single form control but correct, not on the datasheet. The entry you see is the 3rd row value even though it is high enough to show multiple rows.
    Click image for larger version. 

Name:	a_lastRow.jpg 
Views:	21 
Size:	2.6 KB 
ID:	46180

    Not disputing anything you wrote and I agree the linked code is better for this case. Just thought you might like to know.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #18
    achammar is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2019
    Posts
    48
    Gicu,

    I've tried everything I can think of but I can't get it to work. I put your module into my db, built a query to match the table, added text box... everything to make it match your example, but I just keep getting the error "Subscript out of Range" on this line:

    ReDim vTmp(a1 To a2) As Variant

    I've been working this the entire day so far and my brain is fried, so I think I might take a break for awhile.. lol

    Again thank you to all that commented!

  4. #19
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Can you please post a sample text with multiple lines? You should step through the code and see why it is that.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #20
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Please try this updated version, I added another custom function to parse out just the last line in case you want to use that instead.

    Cheers,
    Vlad
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #21
    achammar is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2019
    Posts
    48
    Gicu,


    The fnLastLine function works just like I want it to! I didn't make a query but put the function formula in the control source of another text box instead. There's 2 problems though. If there's no value in the Comment history (The text box the function refers to) then I get a #Type! error/result in the "Last History Entry" (the new unbound text box I added that has the control source set to "=fnLastLine([Comment History])" in the upper and lower portion of the form. The other problem is when I select any record, the new text box in the upper portion goes blank. I'd upload a sample, but for some reason when I do that and someone tried to open it it still gives the "Need newer version of Access" message.
    Anyway, I like the way it works other than that. If you have any ideas and feel like working on it any more, I'll keep watching for any ideas.
    Thank you very much for everything!

  7. #22
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Please see this updated file. Basically try this updated version of the control source: "=fnLastLine(Nz([Comment History]))". That should fix the #Type error. As for the second I don't really get what is happening, can you maybe post a screen shot.

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #23
    achammar is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2019
    Posts
    48
    Gicu,


    It works perfectly! The problem with the data disappearing I think it is a glitch with Access. Although your job is done and I am very happy with it, I am attaching a zip file with 3 screenshots in case you have experienced something like this before and want to see what I'm talking about. First of all I'll tell you why I think it's an Access glitch.
    It only happens after I apply a filter to any field, even if I turn the filter back off, otherwise if I don't apply a filter when I first open the form, the problem does not exist.
    If I don't have the "Last History Entry" text box hidden in the bottom portion (like it is in the pics), the problem does not exist even with a filter on.


    The problem"Last History Entry" is the new text box with the formula in it)
    Pic 1- You see I have a record selected in the upper portion. The "Last history Entry" field does not show (no matter which of the original fields I select)
    Pic 2- I move over and select the "Last History Entry" field and the data pops back up and shows.
    Pic 3- I move up and select the record above it (or any other record) and the data in the first record I selected still shows as does all of them except for the record I currently have selected.


    So anytime I select a record, the data in the "Last History Entry" disappears. Very strange, but I'm sure that's a glitch like I said. But you did your job on this one and it turned out good! If I have to make the new text box visible in the bottom portion to fix that problem, that's what I'll do. I'll just make it inconspicuous.


    It works good! Thank you very much!! I'll close this question and add to you reputation or give you credit... whatever my options are after I make this post!
    Attached Files Attached Files

  9. #24
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    It is probably because you use a split form ( I have never used them myself). Try the hack shown in the screenshot below and it should be fine:
    Click image for larger version. 

Name:	Screenshot 2021-09-14 105740.jpg 
Views:	9 
Size:	212.9 KB 
ID:	46217
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  10. #25
    achammar is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2019
    Posts
    48
    Very good plan! Thanks!

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Import .csv file line item by line with modifications
    By jmichaels in forum Import/Export Data
    Replies: 22
    Last Post: 04-05-2020, 01:44 PM
  2. Replies: 5
    Last Post: 07-16-2017, 01:48 AM
  3. Replies: 5
    Last Post: 06-28-2016, 11:50 AM
  4. Unbound text boxes show #ERROR on data entry line
    By GraeagleBill in forum Forms
    Replies: 4
    Last Post: 01-07-2015, 12:44 AM
  5. Replies: 4
    Last Post: 03-11-2014, 06:38 PM

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