By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,479 Members | 1,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,479 IT Pros & Developers. It's quick & easy.

On Current Event not triggered

100+
P: 122
I have an intake form that is opened by clicking a control on a search form. This click runs a subroutine in the search form that uses DoCmd.OpenReport with stLinkCriteria.

In the intake form I have a subroutine that is set to run OnCurrent - Private Sub Form_Current().

Here's where it gets weird. When I open the intake form by clicking the control in the search form, the code does not run (the results would be visible on the screen).

However, if I put a Breakpoint in the code and open the form exactly the same way, it takes me directly to the code where I can F5 to run it.

What's going on? Has anyone seen this before?
Jul 9 '09 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,679
@Annalyzer
How about displaying the code in the Control on the Search Form, as well as the code in the Current() Event of the Intake Form?
Jul 9 '09 #2

100+
P: 122
It's very simple code, really.

From the control on the search form:
Expand|Select|Wrap|Line Numbers
  1. Private Sub memLast_Click()
  2. On Error GoTo Err_memLast_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stLinkCriteria = "hhId=" & Me.hhId
  8.     DoCmd.OpenForm "frmHousehold", , , stLinkCriteria
  9.  
  10.  
  11. Exit_memLast_Click:
  12.     Exit Sub
  13.  
  14. Err_memLast_Click:
  15.     MsgBox Err.Description
  16.     Resume Exit_memLast_Click
  17.  
  18. End Sub
And from the intake form:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     Dim monthCount, yearCount As Integer
  3.  
  4.     monthCount = Me![sfrmHiddenFBMonthCount].[Form]![txtFBCount]
  5.     If monthCount > 1 Then
  6.         Label34.Visible = False
  7.         txtBoxesThisMonth.Visible = False
  8.         Label35.Visible = False
  9.         lblExceededMonthLimit.Visible = True
  10.     End If
  11.  
  12.     yearCount = Me![sfrmFoodbox].[Form]![txtFBCount]
  13.     If yearCount > 11 Then
  14.         Label31.Visible = False
  15.         txtBoxesThisYear.Visible = False
  16.         Label32.Visible = False
  17.         lblExceededAnnualLimit.Visible = True
  18.     End If
  19. End Sub
I tried moving it to other events, but got the same results no matter where I put it. Is it because I'm relying on a value from the subform?
Jul 9 '09 #3

100+
P: 122
Got it. It did have to do with referring to a value from the subform. The value I was pulling was a total in a footer on the subform. As soon as I moved it to it's own hidden subform everything worked perfectly. Thanks for your help.
Jul 9 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.