469,330 Members | 1,270 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

On load Event code prevents users assess to my main form

I have a form (frmSewer) which bounded to tblSewer. The code at the On Load Event is designed to open frmSewer is appropriate date is updated into tblFilingdatesat the end of each quarter.

In other words, when a quarter ends, the Administrator must file a quarterly report, once this report id filed, he MUST complete the process by updating tblFilingDates with the date the report was filed.

Everything seems to work in year 2006 until we entered into the year 2007. Suddenly the db locked out....and the only way to unlock the form and keep it open is only when there is a date entry in tblFilingDates.DateFiled.

My On Load Event code is bypassing the date entry field or not reading it at all.
The same code is also duplicated at the AfterUpdate Event of txtPermitNo whic is also malfunctioning as dexcribed above..

Below is the On Load Event code of frmSewer.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Dim iQQ As Integer
  3.     Dim iYY As Integer
  4.  
  5.     'Get current quarter/year based on system date
  6.     iQQ = DatePart("q", Date)
  7.     iYY = DatePart("yyyy", Now())
  8.     'If current date is not last of last quarter
  9.     If DateIsLastQuarterDate(Now()) = False Then
  10.         'If quarter 1 then for previous quarter, we need to subtract the  year also
  11.         If iQQ = 1 Then
  12.             iQQ = 4
  13.             iYY = iYY - 1
  14.         Else
  15.             iQQ = iQQ - 1
  16.         End If
  17.     End If
  18.     'Call the function GracePeriodValidation to see if we are in within the grace period
  19.     'If not then throw an error
  20.     If GracePeriodValidation(Now(), iQQ, iYY) = False Then
  21.         MsgBox "You cannot proceed as no filing date has been entered" & vbCrLf & _
  22.                "for quarter " & iQQ & " " & iYY & "." & vbCrLf & _
  23.                "Please contact your administrator.", vbOKOnly + vbExclamation, FRM_TITLE
  24.         DoCmd.Close
  25.     End If
  26. End Sub
' ************
Jan 19 '07 #1
4 1524
MMcCarthy
14,534 Expert Mod 8TB
Bill I'm uploading the database here for the convenience of other experts.

Mary
Attached Files
File Type: zip frmGetDateFiling.zip (37.0 KB, 78 views)
Jan 19 '07 #2
Bill I'm uploading the database here for the convenience of other experts.

Mary
Thanks for assisting in this regard.
Bill
Jan 19 '07 #3
nico5038
3,080 Expert 2GB
Hmm, are we having here THE billcute from EE ?<LOL>

I found in the procedure GracePeriodValidation this code giving you the problem:
Expand|Select|Wrap|Line Numbers
  1.     'Check current date is within the filing date period
  2.     'Return false if invalid, TRUE otherwise
  3.     dValDate = DateValue(dValDate)
  4.     Debug.Print dValDate, DateAdd("d", GRACE_PERIOD, dLastDate)
  5.     If dValDate >= dLastDate And dValDate <= DateAdd("d", GRACE_PERIOD, dLastDate) Then
  6.         GracePeriodValidation = True
  7.     Else
  8.         GracePeriodValidation = False
  9.     End If
as the graceperiod is set to 14 it won't work after the 14th of this month....

Nic;o)
Jan 20 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
Bill,

Does Nico's reply solve your problem or do you want me to keep working on it.

Mary
Jan 21 '07 #5

Post your reply

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

Similar topics

9 posts views Thread by William Wisnieski | last post: by
3 posts views Thread by Dennis | last post: by
1 post views Thread by Dennis | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.