Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having a brain lock today 1

Status
Not open for further replies.

DeanConsulting

Programmer
Jan 11, 2002
131
US
Hi,

I cannot remember the answer to this and I have not had the time to really take a deep look, so, I thought I would ask the board and see what I get back..

Is there a way to return a UDT from a function?

Ex.

Function GetData() as custType
cust.name = "john doe"
cust.acct = "123456"
cust.bal = "$245.00"
GetData = cust
End Function

Thanks in advance and God Bless..

nb




---------------------------------------
Noble D. Bell
 
Do you mean something like this:

Code:
Private Type custType
    Name As String
    acct As Long
    bal As Currency
End Type

Private Function GetData() As custType
    Dim cust As custType

    cust.Name = "john doe"
    cust.acct = "123456"
    cust.bal = "$245.00"
    GetData = cust
End Function

Private Sub Command1_Click()
    Dim C As custType

    C = GetData
    Debug.Print C.Name
    Debug.Print C.acct
    Debug.Print C.bal
End Sub

If you choose to battle wits with the witless be prepared to lose.

[cheers]
 
No problem. [spin]

If you choose to battle wits with the witless be prepared to lose.

[cheers]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top