passing the "me." to a subroutine

  • Thread starter Thread starter mark kubicki
  • Start date Start date
M

mark kubicki

I'd like to move lines of code to a subroutine which are currently on the
form and execute the methods of "me."

' ...code
Me.Acc = ""
Me.Trim = ""
If Len(Me.basedescription.Value) <> 0 Then
'move the next line into a subroutine named ClearBaseDescription()
Me.basedescription = "" 'abbreviated code for brevity
End If
' ...code

as I've never done this within the "me." context, I'm having a bit of naive
difficulty... what should I be passing to the routine
....ClearBaseDescription (me.) ?

thanks in advance,
mark
 
mark kubicki said:
I'd like to move lines of code to a subroutine which are currently on
the form and execute the methods of "me."

' ...code
Me.Acc = ""
Me.Trim = ""
If Len(Me.basedescription.Value) <> 0 Then
'move the next line into a subroutine named
ClearBaseDescription() Me.basedescription = ""
'abbreviated code for brevity End If
' ...code

as I've never done this within the "me." context, I'm having a bit of
naive difficulty... what should I be passing to the routine
...ClearBaseDescription (me.) ?

thanks in advance,
mark

Pass the keyword Me, as in

Call ClearBaseDescription(Me)

or

ClearBaseDescription Me

Those two statements are equivalent. This one ...

ClearBaseDescription (Me) ' WRONG

.... is incorrect, as it would be interpreted as an attempt to evaluate
the Me object and pass its *value* -- not the object itself -- to the
procedure.

If "Me" is a form, then your procedure ClearBaseDescription should be
declared with a Form parameter as in

Sub ClearBaseDescription(frm As Access.Form)
 

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

Back
Top