more than one expression in OnCurrent property of a form

  • Thread starter Thread starter Marie
  • Start date Start date
M

Marie

Using Access 2000. I already have this code in the
OnCurrent property of my frmSamplesInputForm

=AutoFillNewRecord([Forms]![frmSamplesInputForm])

I also want to have a macro to SetValue of a calculated
field back to the fldDyeTrackingNum field in the Samples
table. My macro's name is: StoreTrackingNumInTable. (The
control on the form trims and combines the Sample Request
Number and the Dye Code to get the tracking number.)

From KB article 209172, I have created the macro. How can
I have both the AutoFill command and the macro to store
the tracking number in the table field in the OnCurrent
property of the form?

Thanks.

Marie
 
Change the OnCurrent to an Event Procedure, in the VBA editor, call all of the routines
you want, one after the other.
 
Wayne,

Could you please tell me what that code would look like
and where I would put it. I have worked all evening and
tried everything but can't get anything to work. Is the
combo the problem?

Your help is much appreciated.

Marie
-----Original Message-----
Change the OnCurrent to an Event Procedure, in the VBA
editor, call all of the routines
you want, one after the other.

--
Wayne Morgan


Marie said:
Using Access 2000. I already have this code in the
OnCurrent property of my frmSamplesInputForm

=AutoFillNewRecord([Forms]![frmSamplesInputForm])

I also want to have a macro to SetValue of a calculated
field back to the fldDyeTrackingNum field in the Samples
table. My macro's name is: StoreTrackingNumInTable. (The
control on the form trims and combines the Sample Request
Number and the Dye Code to get the tracking number.)

From KB article 209172, I have created the macro. How can
I have both the AutoFill command and the macro to store
the tracking number in the table field in the OnCurrent
property of the form?

Thanks.

Marie


.
 
Since you already have what you want done as macros, you could use the RunMacro method of
the DoCmd object.

DoCmd.RunMacro(MacroName, RepeatCount, RepeatExpression)

I am assuming that your AutoFillNewRecord is a macro, since that is the term you used, and
not a Function. If so, in the Event Procedure for the OnCurrent event you would place

DoCmd.RunMacro "AutoFillNewRecord([Forms]![frmSamplesInputForm])"

I'm not completly sure of the syntax to call a macro with a parameter from code since I
don't usually use macros. If you tell me what the macro is doing, I may be able to convert
it to VBA.
 
Back
Top