UDT

J

JonWayn

Is there a built-in VB function that reinitializes the elements of a
user-defined type variable?
 
S

Scott McDaniel

No, but you can declare two variables, one of which is always empty, and set
the "full" one to the empty one:

Dim udtCustomer As Customer
Dim udtEmptyCustomer As Customer

Set udtCustomer = udtEmptyCustomer

Long as you haven't used udtEmptyCustomer for anything, it'll be empty. Note
that if your UDTs are very large, this can take up some resources, in which
case you'd be better off writing a simple routine that would assing
vbNullString, 0, etc etc to the appropriate members.
 
J

JonWayn

Thank you. That's cool.


Scott McDaniel said:
No, but you can declare two variables, one of which is always empty, and set
the "full" one to the empty one:

Dim udtCustomer As Customer
Dim udtEmptyCustomer As Customer

Set udtCustomer = udtEmptyCustomer

Long as you haven't used udtEmptyCustomer for anything, it'll be empty. Note
that if your UDTs are very large, this can take up some resources, in which
case you'd be better off writing a simple routine that would assing
vbNullString, 0, etc etc to the appropriate members.
 

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