Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / ActiveX Controls / August 2004

Tip: Looking for answers? Try searching our database.

REPOST command button code for report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
K Crofts - 10 Aug 2004 11:20 GMT
Hi
I have a command button on my form that will print a
report. the report shows the relevant date and todays
date. Is there any way to set up the button so that if the
dates are within 7 days of each other on the report a
message box with an error message is displayed?
Any help appreciated.
Ken Snell - 10 Aug 2004 13:35 GMT
This question should be posted in the reports newsgroup.

What type of error message? How does the "relevant" date get on the report?
More details, please.

Signature

       Ken Snell
<MS ACCESS MVP>

> Hi
> I have a command button on my form that will print a
[quoted text clipped - 3 lines]
> message box with an error message is displayed?
> Any help appreciated.
K Crofts - 11 Aug 2004 14:31 GMT
hi
Posted on ActiveX controls page as this has been of the
most use to me to date, i have posted this numerous times
on the report pages but nop-one can help or refers me
elsewhere for coding. The report shows the relevant date
(this is a diary based programme so the primary key is the
date, this is also my record identifier) and will also
show the date that the report was printed. I want a
message box to be displayed (''unable to confirm as within
7 days'') when the two dates are within 7 days of each
other, the report then needs to close as unsucessful.
>-----Original Message-----
>This question should be posted in the reports newsgroup.
[quoted text clipped - 11 lines]
>
>.
Ken Snell - 11 Aug 2004 15:09 GMT
So you are putting these two dates in the report's header section, and you
want to not print the report if the two dates are withing 7 days of each
other?

How are you opening the report? Is the report's recordsource already in use
by a form that may call the report? Likely, there would be no need to
actually open the report, rather just use code to test the condition and
then either open the report if more than 7 days, or display message box if
less than 7 days and not open report.

If you can provide a few more details, we should be able to get you to a
solution.

Signature

       Ken Snell
<MS ACCESS MVP>

> hi
> Posted on ActiveX controls page as this has been of the
[quoted text clipped - 26 lines]
> >
> >.
K Crofts - 11 Aug 2004 16:46 GMT
cheers Ken
this is a basic programme, recordsource for form is a
table ('collections'), users will not have access to the
table it will purely be used for storing the information
that users enter/modify via the form. the two dates will
be in the report header so testing teh condition for
opening the report/diplaying an error message sounds
perfect. The report is opened from a command button
('reportcomm'). Hope this is enough information, i really
appreciate your help.

>-----Original Message-----
>So you are putting these two dates in the report's header section, and you
[quoted text clipped - 42 lines]
>
>.
Ken Snell - 11 Aug 2004 19:17 GMT
I'll give you some generic code to start and then you can fill in the gaps.
This code assumes that it's run by clicking a command button (reportcomm) to
open the report:

Private Sub reportcomm_Click()
   If DateDiff("d", [PrimaryKeyDate], Date()) > 7 Then
       DoCmd.OpenReport "report name"
   Else
       MsgBox "You cannot open the report at this time."
   End If
End Sub

Signature

       Ken Snell
<MS ACCESS MVP>

> cheers Ken
> this is a basic programme, recordsource for form is a
[quoted text clipped - 69 lines]
> >
> >.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.