Ok, thats not realy what i'm trying to achieve, i'll try and explain it abit better:
ok i have the type contact as so:
type contact
first_name as string
last_name as string
etc...
end type
my form that i will be using the procedure on has a combobox, in this combo box it lists text:
'First_name'
'Last_Name'
etc...
The sorting proedure i have writen should work something like so:
sub sort_contacts(byref contacts as contact, byval field as field type)
for tmp = 1 to totcontacts
if contacts(tmp).field > contacts(tmp+1).field then
tmp2 = contacts(tmp)
contacts(tmp) = contacts(tmp+1)
contacts(tmp+1) = tmp2
endif
next
end sub
the procedure would be call as so:
call sort_contacts(contacts(), com_Fields.text)
but i dont know how to do this, at the moment field is defined as a string, so say i select First_name in the combo box, i would then put field as 'First_name' which is the same as the field name in type contact, what the procedure tries to do is put the variable field as a string the put it in as the field on contacts(tmp).field as you can probably see, but it doesn't work. can anyone see how to do this properly the way i'm trying.
thanks
ok i have the type contact as so:
type contact
first_name as string
last_name as string
etc...
end type
my form that i will be using the procedure on has a combobox, in this combo box it lists text:
'First_name'
'Last_Name'
etc...
The sorting proedure i have writen should work something like so:
sub sort_contacts(byref contacts as contact, byval field as field type)
for tmp = 1 to totcontacts
if contacts(tmp).field > contacts(tmp+1).field then
tmp2 = contacts(tmp)
contacts(tmp) = contacts(tmp+1)
contacts(tmp+1) = tmp2
endif
next
end sub
the procedure would be call as so:
call sort_contacts(contacts(), com_Fields.text)
but i dont know how to do this, at the moment field is defined as a string, so say i select First_name in the combo box, i would then put field as 'First_name' which is the same as the field name in type contact, what the procedure tries to do is put the variable field as a string the put it in as the field on contacts(tmp).field as you can probably see, but it doesn't work. can anyone see how to do this properly the way i'm trying.
thanks