Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What is wrong with referencing the SubForms directly? http://www.mvps.org/access/forms/frm0031.htm
    You are sugesting a kluge that may not work all of the time. The busier the system the longer the delay.

  2. #17
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by weekend00 View Post
    The OP is at lunch.
    Comic relief, as always.

    Quote Originally Posted by Neutrino View Post
    Sorry, I was at lunch. Both textbox are bound to a Subform that is embedded in this "Form". The textboxes get their value by adding records within the "Subform". So the answer is no, they are not bounded to recordSource of the form.
    Apparently Allan understands this, but I don't. I don't get this. what do you mean 'bound to a subform'?? Can't make sense out of that.

    (not essential to answer, but I'd like to know)

  3. #18
    Neutrino is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    11
    Quote Originally Posted by RuralGuy View Post
    You are *definately* fighting a timing issue with the Tasker within Access. To make it work as you have it you either need to reference the SubForm directly instead of waiting for Access to resolve all of the indirections or place the values on the MainForm yourself in code.
    Yes, it is definitely a timing issue!! I can even see how the msgbox pops up before the textboxes updates their values. Now, I'm trying to do it backwards, that is, including an event (say on lost focus) in the Subform, instead of the Form, but I can't make the subform to lose its focus!!!!! I thought it will lose its focus as soon as I click outside the "Subform"...but I guess I'm wrong.

  4. #19
    Neutrino is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    11
    Quote Originally Posted by ajetrumpet View Post
    Comic relief, as always.



    Apparently Allan understands this, but I don't. I don't get this. what do you mean 'bound to a subform'?? Can't make sense out of that.

    (not essential to answer, but I'd like to know)
    What I mean is that the Textboxes get their values by adding records from the Subfom and not from the Form itself. I've tried to put the code inside the Subform and see if this is faster but with no luck!!

  5. #20
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by Neutrino View Post
    What I mean is that the Textboxes get their values by adding records from the Subfom and not from the Form itself.
    that's a complete re-iteration of what you said earlier.

    but regardless, I can't understand this too well and I think Allan will be a better guy to talk to about it. good luck with it!

  6. #21
    Neutrino is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    11
    Quote Originally Posted by RuralGuy View Post
    What is wrong with referencing the SubForms directly? http://www.mvps.org/access/forms/frm0031.htm
    You are sugesting a kluge that may not work all of the time. The busier the system the longer the delay.
    Thanks RuralGuy!!! Maybe I'll try to tackle the problem through another angle, how about using another event other than "Oncurrent"? Maybe if I explain what I want to accomplish it will be easier. I have a Form and a Subform were I insert accounting entries (you know debits and credits) and all I wanted to do is to warn the usser if their Debits and Credits are not the same (you know, their sum must always be equal), hence pop up a msgBox once the usser is done entering the amounts and gets out of the "Subform".

  7. #22
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    When you leave the SubForm if the record is dirty then you will get a BeforeUpdate event from the SubForm as it will save the record. Use it to do the calculation and pop up your MsgBox. I assume it is just one SubForm in Continuous Form mode.

  8. #23
    Neutrino is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    11
    Quote Originally Posted by RuralGuy View Post
    When you leave the SubForm if the record is dirty then you will get a BeforeUpdate event from the SubForm as it will save the record. Use it to do the calculation and pop up your MsgBox. I assume it is just one SubForm in Continuous Form mode.
    Thanks guys, I got away with your suggestion RuralGuy of calculating directly in the code so I change my code to the following:

    Private Sub Form_Current()
    Dim Debe, Haber As Single

    Debe = DSum("Debe", "Comprobante Qry", "[IDDiario] = " & [Diario Nro])
    Haber = DSum("Haber", "Comprobante Qry", "[IDDiario] = " & [Diario Nro])

    If Debe = Haber Then
    MsgBox "ok", vbOKOnly
    Else
    MsgBox "error", vbOKOnly
    End If

    End Sub


    This instead of getting the values from a textbox which in turn calculates from a Subform. Bottom line, it gave me timing delay and a headache.

    So thank you all in helping me out!!

  9. #24
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! FYI in your "Dim Debe, Haber As Single" line, only Haber is dimentioned as a Single, Debe will be defined as a Variant. To have them both defined as Single you would need to use: Dim Debe As Single, Haber As Single
    If your ready then go ahead and use the Thread tool and mark this thread as Solved.

  10. #25
    Neutrino is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    11
    Quote Originally Posted by RuralGuy View Post
    Great! FYI in your "Dim Debe, Haber As Single" line, only Haber is dimentioned as a Single, Debe will be defined as a Variant. To have them both defined as Single you would need to use: Dim Debe As Single, Haber As Single
    If your ready then go ahead and use the Thread tool and mark this thread as Solved.
    Thanks for clarifying that for me!! that's new to me. I'll correct it in my code.

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

Similar Threads

  1. Replies: 2
    Last Post: 12-16-2010, 02:46 PM
  2. Replies: 1
    Last Post: 12-05-2010, 02:34 AM
  3. OnCurrent error
    By dreamweaver547 in forum Security
    Replies: 1
    Last Post: 03-14-2010, 01:45 PM
  4. Replies: 21
    Last Post: 06-03-2009, 05:54 PM
  5. Access Database size Grows too fast
    By no-e in forum Access
    Replies: 0
    Last Post: 12-16-2008, 02:29 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