Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Chicago, IL

    Unanswered: Lost in Space...

    I feel totally lost right now...

    All I want to do is make a function work! I've never done this before...

    I am trying to make it so when I click a button on a form, a new mail message would be created in Lotus Notes and the contents of one field will be copied into the msg body.

    As for a function, I have the (possibly VBA?) code cleaned up and tweaked to my needs but now I have no clue how to get it to work! I've copied it into a module, copied it into the code builder screen... I've scratched it into the back of my skull but I'm still so totally lost.

    I can't find any resource on the net to explain how to call a function and make it work! Or how I should create the function!! public? private? aaagh!

    any help would be appreciated.

  2. #2
    Join Date
    Oct 2003
    Chicago, IL
    Let me rephrase this: How can I reference (call, invoke, whatever) a function from the click of a button?


  3. #3
    Join Date
    Dec 2002
    Préverenges, Switzerland
    aaah! with the rephrase it becomes simple.

    you have a command button.

    it has a name (if in doubt, check Properties¦Other¦Name and either live with the absurd default name or edit it (same place)), then

    alt-F11 opens the code window: in the top-left combo, select the name of your button. default event for a button is the _Click() event. put your call inside the proto-subroutine that Access generates after you select from the combo.

    if you really mean a "function" then your function is expecting to return a value to the caller so you need:

    Private Sub yourButton_Click() 'which Access does for you, then:
    Dim junk as Xxxxx 'where Xxxxx is whatever the return-type is
    'or... Dim junk as variant 'if you don't know what type the return is
    'followed by the call
    junk = functionName(param1, param2) 'etc for however many parameters you have.
    msgbox junk,,"The return was:" 'just for fun to see what the function returns
    End Sub 'which Access does for you

    if your "function" is really a subroutine, it's the same except the call is:
    subroutineName param1, param2 'etc

    Last edited by izyrider; 01-17-04 at 14:38.
    currently using SS 2008R2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts