Run code from macro

  • Thread starter Thread starter EdHaddock
  • Start date Start date
E

EdHaddock

I have a need to run the following code from a macro:

Private Sub Combo14_AfterUpdate()

' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ProjectName] = '" & Me![Combo14] & "'"
Me.Bookmark = rs.Bookmark

End Sub

Can this be converted to a macro or can it be run from an existing macro? Any
help is appreciated. Thanks Ed
 
Ed,

There is not direct equivalent to this code in a macro.

You could replace it with a macro like this:
Action: GoToControl
Control: [ProjectName]
Action: FindRecord
Find What: =[Combo14]

An alternative would be to write the code as a Function, and then you
could use the RunCode action in a macro.

I am curious why you want to run VBA procedure with a macro, seems very
unusual and I can't think of a scenario when you would need this.
 
Back
Top