472,782 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 software developers and data experts.

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 1633
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, 97 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

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

Similar topics

9
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a main form with a continuous subform. On the main form I have a text field called . It gets populated based on what the user selects in a field on the...
5
by: Ivan | last post by:
I am used to VB6 and am not sure how to do this in Vstudio .NET. I have a main form which calls other forms. I want to disable that main form while other ones are called. I tried hiding it and...
3
by: Dennis | last post by:
I have the following code for showing a form: dim frm as new myForm frm.ShowDialog (The Form Load Event is fired then I hide the form using Me.Hide when the X in the UR corner is clicked). ...
6
by: MLH | last post by:
I don't always get what I want when I invoke the following Me!MySubFormControl.Refresh from code running in the main form. Am I doing something wrong here? Someone suggested that I open the...
3
by: virtualgreek | last post by:
Dear all, I have a scenario that is driving me nuts. (MS Access 2003) I have a form/subform (Continuous form) where it gets its data from tables Order and Order_Details. In the footer...
4
by: abolos | last post by:
Hi all, I have a question. If I have a form that has a vb code in the Open Event and another code in Load Event, which one starts before when running this form? Does the Load Event code runs...
1
by: Dennis | last post by:
I've noticed some old posts regarding this issue; but nothing recently and no resolutions in the old postings. Its almost hard for me to believe that this wouldn't be fixed by now. I am using...
5
by: mdzeier | last post by:
I need to know how to maxinimze subforms to the size of the main form. I have managed to do the code to maximize the main form, but it does not work on the subforms. The main form contains 6...
0
by: Saboor Mohideen | last post by:
Can someone tell me which event occurs on Total TextBox: Main Form Name Type Event Used Event Set All three textboxes are bound to a table CashAmount TextBox ...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.