Reserved Error (1 Viewer)

vanzie

Member
Local time
Tomorrow, 01:33
Joined
Aug 23, 2020
Messages
42
Hi everyone

In my database when I want to view a report, I go to the search form where I can input the date criteria. When I choose to view the last 30 days of the records, I get the following error:

Reserved error (I); there is no message for this error

Any idea what it might be and a way to fix this?
 

Ranman256

Well-known member
Local time
Today, 19:33
Joined
Apr 9, 2015
Messages
4,339
You didn't show us the query.
In it get the last 30days:
select * from table where [dateFld] between Date() and DateAdd("d",-30, Date())
 

June7

AWF VIP
Local time
Today, 15:33
Joined
Mar 9, 2014
Messages
5,423
Not without seeing your code and maybe even report design. If you want to provide db for analysis, follow instructions at bottom of my post.
 

vanzie

Member
Local time
Tomorrow, 01:33
Joined
Aug 23, 2020
Messages
42
The code when you click Last 30 days is:

Private Sub btnMonth_Click()
'Sets the Date From and Date To text boxes
'to show the last 30 days

Me!StartDate = Date
Me!EndDate = DateAdd("M", -1, Me!StartDate)
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 07:33
Joined
May 7, 2009
Messages
19,169
don't you think it should be the reverse:

Me!StartDate = DateAdd("m", -1, Date)
Me!EndDate = Date
 

vanzie

Member
Local time
Tomorrow, 01:33
Joined
Aug 23, 2020
Messages
42
Here is the database

There isn't many confidential data in so go ahead and have a look

the username is sampleu and password is newpassword
 

Attachments

  • 08-24 10-01.zip
    1.1 MB · Views: 107

vanzie

Member
Local time
Tomorrow, 01:33
Joined
Aug 23, 2020
Messages
42
Hi Arnel

I am working on an updated database and corrected that issue with the new version
 

bob fitz

AWF VIP
Local time
Today, 23:33
Joined
May 23, 2011
Messages
4,717
Here is the database

There isn't many confidential data in so go ahead and have a look

the username is sampleu and password is newpassword
Can't see anything attached
 

vanzie

Member
Local time
Tomorrow, 01:33
Joined
Aug 23, 2020
Messages
42
Here is the database

There isn't many confidential data in so go ahead and have a look

the username is sampleu and password is newpassword


I forgot that user level 3 is standard user and wont be able to view reports when you log in so keep shift in when opening
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 07:33
Joined
May 7, 2009
Messages
19,169
you forgot to upload the Backend db.
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:33
Joined
Sep 21, 2011
Messages
14,048
And the form name is..............?
 

vanzie

Member
Local time
Tomorrow, 01:33
Joined
Aug 23, 2020
Messages
42
Sorry guys. Here is the front end and back end file. The form where I get the issue from is ViewReports. Clicking on Last 30/31 Days and search gives me the error
 

Attachments

  • 07-14 11-12_be.zip
    2.2 MB · Views: 106

Gasman

Enthusiastic Amateur
Local time
Today, 23:33
Joined
Sep 21, 2011
Messages
14,048
My access is too old I'm afraid, though you still have that date bug in th 07 version?
I keep getting module not found, but that might just be my old version causing that.?

Any way, surely the last 30 days would be more like this?, using todays date?

Code:
Private Sub btnMonth_Click()
'Sets the Date From and Date To text boxes
'to show the last 30 days

    Me!StartDate = DateAdd("M", -1, Date)
    Me!EndDate = Date
End Sub
 

CJ_London

Super Moderator
Staff member
Local time
Today, 23:33
Joined
Feb 19, 2013
Messages
16,553
you might want to consider using me. rather than me!. Me. uses intellisense and will pick up typo's etc at compile time. Me! does not and will fail at run time.

I also recommend you put Option Explicit just below Option Compare Database at the top of each module. To do this automatically for new modules, go to tools>options>editor and tick the 'require variable declaration' option

Took a look at your code, nothing obvious other than you have not fixed the error already pointed out and you don't normally call a function by specifying the module.

Have you tried stepping through the code? To see at what point the error occurs.

Not sure if it is significant, but DateAdd("M", the M should be lower case - DateAdd("m"
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:33
Joined
Sep 21, 2011
Messages
14,048
You have also made the same error for 7 days?
Code:
Private Sub btnL7Days_Click()
'Sets the Date From and Date To text boxes
'to show complete month (from start to end of current month)

    Me!StartDate = Date
    Me!EndDate = Me!StartDate - 6
End Sub
 

vanzie

Member
Local time
Tomorrow, 01:33
Joined
Aug 23, 2020
Messages
42
You have also made the same error for 7 days?
Code:
Private Sub btnL7Days_Click()
'Sets the Date From and Date To text boxes
'to show complete month (from start to end of current month)

    Me!StartDate = Date
    Me!EndDate = Me!StartDate - 6
End Sub

If I click last 7 days it shows me the records but not 30 days. I will look into your suggestions and see what comes up. It worked perfectly before but somehow today it showed me that error
 

vanzie

Member
Local time
Tomorrow, 01:33
Joined
Aug 23, 2020
Messages
42
Ive changed the code and did a debugging but no error showed. It seems it only does that with the first check box. The dutycontrol table might be the cause of it because viewing the other reports does not give that error
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 07:33
Joined
May 7, 2009
Messages
19,169
rebuild the report. possible corruption.
 

Users who are viewing this thread

Top Bottom