How convert macro to code?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm debugging a problem and a macro is involved (I did not write this!). I
need to convert the macro to code so I can insert debugging statements. Here
is what the macro does:
1. OpenForm Assignment Information
2. GoToControl Assignment Number
3. FindRecord =[Forms]![Applicant Recipient Search]![AR Search
SubForm].[Form].[AssignNo]

Later on (in a module) called from the form_current event there is a
screen.activecontrol statement that fails because there is no active control
even though there is a setfocus statement being executed. Any ideas?
It appears to be data related since I can open an old datafile with the
front-end and get no problem.
 
Hi.
I
need to convert the macro to code

Select the name of the macro in the Database Window. Select the Tools ->
Macro -> Convert Macros to Visual Basic menu, then press the "Convert"
button, and press the "OK" button when it's done. Select the Debug ->
Compile <DatabaseName> menu in the VB Editor to compile the code. Press
<ALT><F11> to return to the Access Window. Rename the macro to something
else, such as mcrOpenAssignInfo_DeleteThis. Open your form in Design View
and go to the Form OnCurrent event. Change the macro's name to the public
function's name. For example, change:

mcrOpenAssignInfo

To:

=mcrOpenAssignInfo()

Save the form, and open your form in Form View, whereupon the new VBA
procedure will be used instead of the macro. Once you know the VBA
procedure works, delete the renamed macro.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.


mscertified said:
I'm debugging a problem and a macro is involved (I did not write this!). I
need to convert the macro to code so I can insert debugging statements.
Here
is what the macro does:
1. OpenForm Assignment Information
2. GoToControl Assignment Number
3. FindRecord =[Forms]![Applicant Recipient Search]![AR Search
SubForm].[Form].[AssignNo]

Later on (in a module) called from the form_current event there is a
screen.activecontrol statement that fails because there is no active
control
even though there is a setfocus statement being executed. Any ideas?
It appears to be data related since I can open an old datafile with the
front-end and get no problem.
 
Back
Top