Form Timer

C

CS

I have a form that uses a timer to start a module. My problem is that it
runs through the all the steps of the module. (mostly qapp queries, with 2
spreadsheet transfers). When it gets to the end of the module I then get the
following error. Am I doing something wrong in the module or is it in the
code for the timer. I am not a great access programmer, I piece things
together so any help that you could provide would be greatly appreciated.
This is the error I get (error 2520, Thies acotion or method requires a
module of process Name Argument)but when I check the tables all of the code
has run.

Private Sub Form_Timer()

Select Case Time()

Case #7:40:00 AM# To #7:48:00 AM#
Select Case Format(Date, "w")
'= Sun thru Sat
Case 1 To 7
Me.lblMessage.Caption = "Running East Region Production..."
Me.lblMessage.Visible = True
Me.txtStart1 = Time()
DoCmd.OpenModule , EastRegionProduction
DoCmd.Close , EastRegionProduction
Me.txtEnd1 = Time()
Me.lblMessage.Caption = "EAST REGION PRODUCTION REPORTS
SENT!"
Case Else
'DO NOTHING(=Sun)
End Select


Case Else
'DO NOTHING
End Select
End Sub
 
G

Guest

It looks like there are problems in the two DoCmd statements.
The general syntax to open a module is

expression.OpenModule(ModuleName, ProcedureName)

In your statement:

DoCmd.OpenModule , EastRegionProduction

you should have quotes around the procedure name:

DoCmd.OpenModule , "EastRegionProduction"


The module name is optional - Access will search every module to find the
procedure - but you should enter it. You are not using comments in your
code; in the future, if anyone else has to modify the code, it would help to
know *in which module* the procedure is located.


In the line

DoCmd.Close , EastRegionProduction


The syntax is

expression.Close(ObjectType, ObjectName, Save)


An example is:

DoCmd.Close acModule, "Module1", acSaveNo


You are missing the module name (and missing quotes) - you can't close a
procedure (if EastRegionProduction is the name of the procedure). Also, it
would be better to include the optional items..... makes it easier to
troubleshoot and to modify in the future.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top