Need help about return value from Module Function

M

March

Hello,

I'm new to write VBA code. I have written a code to convert date in my owned
format. I write the code in Module. For example

Sub pDFunction(ByVal pD As String)
....
....
....

pD

End Sub


In a form

I create a textbox for user input value of "pD".

Once i hit button


Private Sub Command0_Click()

CDTxt = Format(CDTxt, "mm/dd/yyyy")
Call pDFunction(CDTxt)

End Sub

With Call pDFunction(CDTxt) is working well. But I don't know how to return
the value of "pD" at the end of the Module showing in another textbox in my
form.

Please give me suggestion.

March
 
J

Jeanette Cunningham

March,
try this:

Private Sub Command0_Click()

CDTxt = Format(CDTxt, "mm/dd/yyyy")
Me.txtNewControl = pDFunction(CDTxt)

End Sub

replace txtNewControl with the name of the other textbox on your form.


Jeanette Cunningham
 

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

Top