Help with GoToRecord,Next command in Macro

G

Guest

Hi Everyone..

Im just wondering if I can get some help on the above subject.
I inherited a database (from a co-worker who left the company), with macros
within macros and it keeps on halting on the GoToRecord.Form.<FormName>.Next
commands within one of the Macros. I suspect that the macro stops when it
reaches the last record and no more records to process.

Any suggestions on how to fix this issue?? I'd appreciate it very much for
any help I can get.

Thanks !!
 
S

Steve Schapel

Rob,

Can you give any more information?... What actually happens? What
events are these macros triggered by?

If the problem was that you are already at the last record, I would
expect you would see an error message?
 
G

Guest

Hi Steve

First of all, thanks for taking the time to answer my posting. Really
appreciate it!

Here's the error message when I run the macros:
Action failed:
Macroname: DacodaMacro
Condition:True
Action Name: GoToRecord
Arguments: 2, DacodaForm2edit,Next,

And here's the sequence of Macros that was run under DacodaMacro:

macro name: marcmacro
CONDITION ACTION COMMENT
SetWarnings
OpenQuery open update dates query (b/c dates are
RunCommand used in the repeating of the control macro)
Close
OpenQuery open update CustRef5 query (b/c CustRef5 is used in the control
macro for unique tickets)
OpenForm open form1
Minimize
OpenForm open form2--to edit
Minimize
GoToRecord goto form2--next:DacodaForm2edit
RunMacro runs control macro--repeats till dates are

blank:DacodaMacro.controlmacro

MacroName: controlmacr
[Forms]![DacodaForm1read]![CustRef5]<>[Forms]![DacodaForm2edit]![CustRef5] RunMacro runs advance records:DacodaMacro.advancemacr
[Forms]![DacodaForm1read]![CustRef5]=[Forms]![DacodaForm2edit]![CustRef5] RunMacro runs copy macro: DacodaMacro.nullmacro

nullmacro SetValue
SetValue
SetValue
SetValue
SetValue
SetValue
SetValue
SetValue
GoToRecord advance form1:DacodaForm1read
GoToRecord advance form2:DacodaForm2edit

advancemacro GoToRecord advance form1
GoToRecord advance form2


Maybe I need an error trapping on GoToRecord? If so, how?

Thanks so much !!

Rob
 
S

Steve Schapel

Rob,

I can't immediately see where the problem lies. Your suggestion about
"error trapping" would be a good idea, except that you can't do error
trapping in macros. The best you can do really is to insert blank lines
in strategic places in the macros and run them experimentally to help
identify precisely where the problem is occurring, and/or inserting
MsgBox actions in the macro to help keep track of the progress. There
is also a "single step" function you can use to walk through the macro.
The first thing I would check is the GoToRecord action in the
"marcmacro" macro, and see that the Object Type argument is set to Form.
Also I would check the purpose of the Close action in this macro... it
doesn't seem right.

The problem may also be occurring in the "nullmacro" or the "advancemacro".

--
Steve Schapel, Microsoft Access MVP
Hi Steve

First of all, thanks for taking the time to answer my posting. Really
appreciate it!

Here's the error message when I run the macros:
Action failed:
Macroname: DacodaMacro
Condition:True
Action Name: GoToRecord
Arguments: 2, DacodaForm2edit,Next,


And here's the sequence of Macros that was run under DacodaMacro:

macro name: marcmacro
CONDITION ACTION COMMENT
SetWarnings
OpenQuery open update dates query (b/c dates are
RunCommand used in the repeating of the control macro)
Close
OpenQuery open update CustRef5 query (b/c CustRef5 is used in the control
macro for unique tickets)
OpenForm open form1
Minimize
OpenForm open form2--to edit
Minimize
GoToRecord goto form2--next:DacodaForm2edit
RunMacro runs control macro--repeats till dates are

blank:DacodaMacro.controlmacro

MacroName: controlmacro
[Forms]![DacodaForm1read]![CustRef5]<>[Forms]![DacodaForm2edit]![CustRef5] RunMacro runs advance records:DacodaMacro.advancemacro
[Forms]![DacodaForm1read]![CustRef5]=[Forms]![DacodaForm2edit]![CustRef5] RunMacro runs copy macro: DacodaMacro.nullmacro

nullmacro SetValue
SetValue
SetValue
SetValue
SetValue
SetValue
SetValue
SetValue
GoToRecord advance form1:DacodaForm1read
GoToRecord advance form2:DacodaForm2edit

advancemacro GoToRecord advance form1
GoToRecord advance form2


Maybe I need an error trapping on GoToRecord? If so, how?

Thanks so much !!

Rob
 
G

Guest

Thanks Steve. I will try your suggestions. By the way, I forgot to mention
that this database was originally on Access97 and I converted it to
Access2002 XP. Do you think some functionalities are not working due it came
from an earlier version? These macros was running seemlessly on A97. Thanks !

Steve Schapel said:
Rob,

I can't immediately see where the problem lies. Your suggestion about
"error trapping" would be a good idea, except that you can't do error
trapping in macros. The best you can do really is to insert blank lines
in strategic places in the macros and run them experimentally to help
identify precisely where the problem is occurring, and/or inserting
MsgBox actions in the macro to help keep track of the progress. There
is also a "single step" function you can use to walk through the macro.
The first thing I would check is the GoToRecord action in the
"marcmacro" macro, and see that the Object Type argument is set to Form.
Also I would check the purpose of the Close action in this macro... it
doesn't seem right.

The problem may also be occurring in the "nullmacro" or the "advancemacro".

--
Steve Schapel, Microsoft Access MVP
Hi Steve

First of all, thanks for taking the time to answer my posting. Really
appreciate it!

Here's the error message when I run the macros:
Action failed:
Macroname: DacodaMacro
Condition:True
Action Name: GoToRecord
Arguments: 2, DacodaForm2edit,Next,


And here's the sequence of Macros that was run under DacodaMacro:

macro name: marcmacro
CONDITION ACTION COMMENT
SetWarnings
OpenQuery open update dates query (b/c dates are
RunCommand used in the repeating of the control macro)
Close
OpenQuery open update CustRef5 query (b/c CustRef5 is used in the control
macro for unique tickets)
OpenForm open form1
Minimize
OpenForm open form2--to edit
Minimize
GoToRecord goto form2--next:DacodaForm2edit
RunMacro runs control macro--repeats till dates are

blank:DacodaMacro.controlmacro

MacroName: controlmacro
[Forms]![DacodaForm1read]![CustRef5]<>[Forms]![DacodaForm2edit]![CustRef5] RunMacro runs advance records:DacodaMacro.advancemacro
[Forms]![DacodaForm1read]![CustRef5]=[Forms]![DacodaForm2edit]![CustRef5] RunMacro runs copy macro: DacodaMacro.nullmacro

nullmacro SetValue
SetValue
SetValue
SetValue
SetValue
SetValue
SetValue
SetValue
GoToRecord advance form1:DacodaForm1read
GoToRecord advance form2:DacodaForm2edit

advancemacro GoToRecord advance form1
GoToRecord advance form2


Maybe I need an error trapping on GoToRecord? If so, how?

Thanks so much !!

Rob
 
S

Steve Schapel

Rob,

I have heard other reports of macros needing to be tweaked after
conversion of the database from Access 97 to later versions.
 

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