Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 40
  1. #16
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Believe me, I try to understand all that, and it's not about language (for me) it's about relating all those names to a myriad of objects you have, some of which appear to be the same name. I saw what subform1 query does, so no issue there I think. I don't think we're on the same page with the No Yes thing. Like I said, when subform1 current event fires, the first record is the active one. The 2nd record contains No, the 1st contains yes. Which one do you expect to govern what happens to subform2?

    As an aside, it appears main form subform1 control master/child links are 2 fields from the subform query, neither of which I found on the subform. The main form and the subform are supposed to have related fields on them and I don't see that but somehow you seem to have it working, assuming the data is correct. Perhaps that is a non-issue so we don't need to go there I guess.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #17
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Please review this updated file and let me know if that is what you wanted to happen. I added the show\hide refresh to the current event of the first subform and also to the afterupdate of the list box that opens modal when you click the Overhead Expenses combo (look for 'Vlad in the VBA comments)

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

  3. #18
    Perfac's Avatar
    Perfac is offline Expert
    Windows 10 Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Sorry I feel stupid. Where is the updated file?

  4. #19
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Sorry, don't be, I should, coming right up 😞

  5. #20
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Here it the file .

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

  6. #21
    Perfac's Avatar
    Perfac is offline Expert
    Windows 10 Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Micron. After selecting the "sub ledger account" on Sub form 1, I planned to let Subform2 become visible on top of Sub Form 1, so the user is forced to capture Subform 2. The record in Subform1 will still be open. The text field for this record will all the time be returning "Yes". Subform1 has a child field linking to the main form, and Subform2 has a child field linking to Subform 1, that part works. You can see that. I did a few tests and learned some new things as well. Here is one test.

    1. I added a field to the table, and called it on the form. Say Text5
    2. AfterUpdate event on Text5 I used the line you gave me. Me.f02JournalsSubAcc.Visible = Me.Text5 = 5
    3. If I capture a 5 in textbox on the main form Subform2 instantly appears, if I capture anything else Subform2 is gone instantly. That is what I am used to.
    4. It does not work under current event. The other tests as well.

    I believe I will find some unconventional way before the sun shines here.

  7. #22
    Perfac's Avatar
    Perfac is offline Expert
    Windows 10 Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Hey Vlad that seems to be perfect. Some days I think I reached 50% know how. Other days I think I reached 5% know how. I have to find time to learn more about show/hide.
    Thank you.

  8. #23
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    I think you had the code right, just needed to find the right event(s) to place it. Value changes for controls bound to expressions don't trigger their AfterUpdate event, so we needed to find the one that does get trigger and that was on the popup dialog form

    Cheers,

  9. #24
    Perfac's Avatar
    Perfac is offline Expert
    Windows 10 Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Hi. If you open the same form f02Journals. Tab through the first record. When you tab past the second line, this error on image comes up.
    Click image for larger version. 

Name:	230310a.png 
Views:	21 
Size:	4.7 KB 
ID:	49863Click image for larger version. 

Name:	230310b.png 
Views:	21 
Size:	16.7 KB 
ID:	49864

  10. #25
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    The Me.txtSubAccount would be null in that case so us Nz() function to replace that with whatever default state you want the subform 2 to be:
    Code:
    Me.Parent.f02JournalsSubAcc.Visible=Nz(Me.txtSubAccountA2,"No") ="Yes" ' this would leave the subaccount subform hidden
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  11. #26
    Perfac's Avatar
    Perfac is offline Expert
    Windows 10 Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Thanks a million!

  12. #27
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  13. #28
    Perfac's Avatar
    Perfac is offline Expert
    Windows 10 Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Hi Vlad. Sorry if I use more of your time. My app has 5 documents that use form f02InvLdgrAccItm, just as a list to select from. The line you added calls form. f02JournalsSub. It seems if any of the other 4 documents open f02InvLdgrAccItm it calls and open f02JournalsSub, which it shouldn't.

    I created f02InvLdgrAccItm five times to have a separate form for each of the documents, and your added line call them and it seems to be working. The other forms are f02Payments, f02Receipts, f02SlsInvcs and f02PrchsInvcs. If that works and it is the way, then I leave it that way, but I would like the 5 forms to be able to use the same f02InvLdgrAccItm. What code can I add to have that result? When I open f02Payments and then f02InvLdgrAccItm it should call f02PaymentsSub and not f02JournalsSub.
    Click image for larger version. 

Name:	230401a.png 
Views:	13 
Size:	38.3 KB 
ID:	50024

  14. #29
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    You should be able to pass the calling form name to that AfterUpdate event, just like you do now with sControl (which I assume is a global variable - sorry, I am traveling now and only have an Android tablet with me). You can use the OpenArgs of the form, a global variable and in the more recent versions of Access a TempVar to do it.
    Forms (sFormToCall)....

    Please let me know how it goes!

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

  15. #30
    Perfac's Avatar
    Perfac is offline Expert
    Windows 10 Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Gees! If you are in British Columbia, you're driving after 24h00. I will try what you say, even though I do not understand right away.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-13-2022, 03:44 AM
  2. AfterUpdate requery does not requery list box
    By ittechguy in forum Programming
    Replies: 5
    Last Post: 09-05-2017, 08:51 AM
  3. Replies: 11
    Last Post: 04-09-2016, 08:54 PM
  4. Replies: 7
    Last Post: 07-01-2015, 10:29 AM
  5. Replies: 1
    Last Post: 05-26-2014, 10:31 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