Userform Textbox as String

creamichoc

New member
Local time
Today, 13:06
Joined
Jul 29, 2009
Messages
6
Hi,

Basic bit of help required here, have built a userform with a textbox & need to capture the content for use in a subsequent module called from the same form.

I would have thought:

Public Sub Command0_Click()
Me!textname1 = pathforlater
Call CodeABC
End Sub

and then using pathforlater would work ...but it doesn't seem to.

Any pointers, would be gratefully received.
 
When you need to pass data along to custom built function, you would do something like this (apoligize for not knowing the correct terminology)

Code:
Public Function MyFunction(strVariable1 as string, strVariable2 as string) as String
 
Myfunction = strVariable1 & " " & strVariable2
 
end function

then, when calling your function, you would include the variables that are needed:

Call MyFunction(Me.Textbox1, Me.Textbox2)

This will then pass along the data needed to run your function. Hope I explained it well enough
 
I would suggest adding code in the AfterUpdate or OnDirty Events.
Use some code like...

Code:
Private Sub Subform_AfterUpdate()
   Dim PathForLater As String
   PathForLater = TextBox
End Sub
Then you have a string variable in the VBA Code to pass along.
And if they were to Update the [TextBox], it would also update the [PathForLater]
 

Users who are viewing this thread

Back
Top Bottom